Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
48 lines (46 loc) · 2.13 KB

File metadata and controls

48 lines (46 loc) · 2.13 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/// <reference path="..\harness.ts" />
namespace ts {
describe("languageService", () => {
const files: {[index: string]: string} = {
"foo.ts": `import Vue from "./vue";
import Component from "./vue-class-component";
import { vueTemplateHtml } from "./variables";
@Component({
template: vueTemplateHtml,
})
class Carousel<T> extends Vue {
}`,
"variables.ts": `export const vueTemplateHtml = \`<div></div>\`;`,
"vue.d.ts": `export namespace Vue { export type Config = { template: string }; }`,
"vue-class-component.d.ts": `import Vue from "./vue";
export function Component(x: Config): any;`
};
// Regression test for GH #18245 - bug in single line comment writer caused a debug assertion when attempting
// to write an alias to a module's default export was referrenced across files and had no default export
it("should be able to create a language service which can respond to deinition requests without throwing", () => {
const languageService = ts.createLanguageService({
getCompilationSettings() {
return {};
},
getScriptFileNames() {
return ["foo.ts", "variables.ts", "vue.d.ts", "vue-class-component.d.ts"];
},
getScriptVersion(_fileName) {
return "";
},
getScriptSnapshot(fileName) {
if (fileName === ".ts") {
return ts.ScriptSnapshot.fromString("");
}
return ts.ScriptSnapshot.fromString(files[fileName] || "");
},
getCurrentDirectory: () => ".",
getDefaultLibFileName(options) {
return ts.getDefaultLibFilePath(options);
},
});
const definitions = languageService.getDefinitionAtPosition("foo.ts", 160); // 160 is the latter `vueTemplateHtml` position
expect(definitions).to.exist; // tslint:disable-line no-unused-expression
});
});
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.