mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 23:13:02 +01:00
make host implement getScriptKind, #203
This commit is contained in:
parent
a210d77cf4
commit
9b5c885b40
1 changed files with 13 additions and 0 deletions
|
|
@ -93,6 +93,19 @@ export class TypeScriptWorker implements ts.LanguageServiceHost {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getScriptKind?(fileName: string): ts.ScriptKind {
|
||||||
|
const suffix = fileName.substr(fileName.lastIndexOf('.') + 1);
|
||||||
|
switch (suffix) {
|
||||||
|
case 'ts': return ts.ScriptKind.TS;
|
||||||
|
case 'tsx': return ts.ScriptKind.TSX;
|
||||||
|
case 'js': return ts.ScriptKind.JS;
|
||||||
|
case 'jsx': return ts.ScriptKind.JSX;
|
||||||
|
default: return this.getCompilationSettings().allowJs
|
||||||
|
? ts.ScriptKind.JS
|
||||||
|
: ts.ScriptKind.TS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentDirectory(): string {
|
getCurrentDirectory(): string {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue