mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add feature flag to support using tsserver for JS files
This commit is contained in:
parent
57bd4f307a
commit
a39afd6057
|
@ -15,6 +15,8 @@
|
|||
"activationEvents": [
|
||||
"onLanguage:typescript",
|
||||
"onLanguage:typescriptreact",
|
||||
"onLanguage:javascript",
|
||||
"onLanguage:javascriptreact",
|
||||
"onCommand:typescript.reloadProjects"
|
||||
],
|
||||
"main": "./out/typescriptMain",
|
||||
|
|
|
@ -33,7 +33,8 @@ export function activate(context: ExtensionContext): void {
|
|||
|
||||
let MODE_ID_TS = 'typescript';
|
||||
let MODE_ID_TSX = 'typescriptreact';
|
||||
let MY_PLUGIN_ID = 'vs.language.typescript';
|
||||
let MODE_ID_JS = 'javascript';
|
||||
let MODE_ID_JSX = 'javascriptreact';
|
||||
|
||||
let clientHost = new TypeScriptServiceClientHost();
|
||||
let client = clientHost.serviceClient;
|
||||
|
@ -45,6 +46,11 @@ export function activate(context: ExtensionContext): void {
|
|||
client.onReady().then(() => {
|
||||
registerSupports(MODE_ID_TS, clientHost, client);
|
||||
registerSupports(MODE_ID_TSX, clientHost, client);
|
||||
let useSalsa = !!process.env['CODE_TSJS'] || !!process.env['VSCODE_TSJS']
|
||||
if (useSalsa) {
|
||||
registerSupports(MODE_ID_JS, clientHost, client);
|
||||
registerSupports(MODE_ID_JSX, clientHost, client);
|
||||
}
|
||||
}, () => {
|
||||
// Nothing to do here. The client did show a message;
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@ import nls = require('vs/nls');
|
|||
import env = require('vs/base/common/flags');
|
||||
import platform = require('vs/platform/platform');
|
||||
import ConfigurationRegistry = require('vs/platform/configuration/common/configurationRegistry');
|
||||
import modesExtensions = require('vs/editor/common/modes/modesRegistry');
|
||||
import {LanguageExtensions} from 'vs/editor/common/modes/languageExtensionPoint';
|
||||
import typescript = require('vs/languages/typescript/common/typescript');
|
||||
import extensions = require('vs/languages/javascript/common/javascript.extensions');
|
||||
import Options = require('vs/languages/typescript/common/options');
|
||||
|
@ -17,7 +17,7 @@ import Mime = require('vs/base/common/mime');
|
|||
|
||||
if (!env.enableTypeScriptServiceModeForJS) {
|
||||
|
||||
modesExtensions.registerMode({
|
||||
LanguageExtensions.registerCompatMode({
|
||||
id: 'javascript',
|
||||
extensions: ['.js', '.es6'],
|
||||
firstLine: '^#!.*\\bnode',
|
||||
|
@ -187,5 +187,12 @@ if (!env.enableTypeScriptServiceModeForJS) {
|
|||
]
|
||||
});
|
||||
} else {
|
||||
Mime.registerTextMimeByFilename('.js', 'text/typescript');
|
||||
}
|
||||
LanguageExtensions.registerLanguage({
|
||||
id: 'javascript',
|
||||
extensions: ['.js', '.es6'],
|
||||
firstLine: '^#!.*\\bnode',
|
||||
filenames: ['jakefile'],
|
||||
aliases: ['JavaScript', 'javascript', 'js'],
|
||||
mimetypes: ['text/javascript']
|
||||
});
|
||||
}
|
|
@ -13,7 +13,7 @@ import {AsyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
|
|||
// contributes the project resolver logic to TypeScript and JavaScript
|
||||
// this guy is for the workbench, but not for the standalone editor
|
||||
|
||||
if (env.enableJavaScriptRewriting) {
|
||||
if (env.enableJavaScriptRewriting && !env.enableTypeScriptServiceModeForJS) {
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/globalVariableRewriter', 'GlobalVariableCollector');
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/angularServiceRewriter', 'AngularServiceRewriter');
|
||||
modesExt.registerWorkerParticipant('javascript', 'vs/languages/typescript/common/js/requireRewriter');
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
'enableJavaScriptRewriting': true,
|
||||
'enableSendASmile' : !!configuration.sendASmile,
|
||||
'enableTypeScriptServiceMode': true || !process.env['VSCODE_TSWORKER'],
|
||||
'enableTypeScriptServiceModeForJS': !!process.env['CODE_TSJS']
|
||||
'enableTypeScriptServiceModeForJS': !!process.env['CODE_TSJS'] || !!process.env['VSCODE_TSJS']
|
||||
};
|
||||
|
||||
var programStart = remote.getGlobal('programStart');
|
||||
|
|
Loading…
Reference in a new issue