diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index 3ccb8bfb924..e207a502c55 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -426,8 +426,12 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient let options: electron.IForkOptions = { execArgv: [] // [`--debug-brk=5859`] }; - if (workspace.rootPath) { - options.cwd = fs.realpathSync(workspace.rootPath); + try { + if (workspace.rootPath) { + options.cwd = fs.realpathSync(workspace.rootPath); + } + } catch (error) { + options.cwd = workspace.rootPath; } let value = process.env.TSS_DEBUG; if (value) { @@ -563,8 +567,17 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient return null; } let result = resource.fsPath; + if (!result) { + return null; + } // Both \ and / must be escaped in regular expressions - return result ? fs.realpathSync(result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/')) : null; + result = result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/'); + try { + result = fs.realpathSync(result); + } catch (error) { + // Do nothing. Keep original path. + } + return result; } public asUrl(filepath: string): Uri { diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 414c2288faf..da7ad5d7ba3 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -573,27 +573,27 @@ export interface DefinitionProvider { * A symbol kind. */ export enum SymbolKind { - File, - Module, - Namespace, - Package, - Class, - Method, - Property, - Field, - Constructor, - Enum, - Interface, - Function, - Variable, - Constant, - String, - Number, - Boolean, - Array, - Object, - Key, - Null + File = 0, + Module = 1, + Namespace = 2, + Package = 3, + Class = 4, + Method = 5, + Property = 6, + Field = 7, + Constructor = 8, + Enum = 9, + Interface = 10, + Function = 11, + Variable = 12, + Constant = 13, + String = 14, + Number = 15, + Boolean = 16, + Array = 17, + Object = 18, + Key = 19, + Null = 20 } /** * @internal @@ -869,21 +869,21 @@ export enum IndentAction { /** * Insert new line and copy the previous line's indentation. */ - None, + None = 0, /** * Insert new line and indent once (relative to the previous line's indentation). */ - Indent, + Indent = 1, /** * Insert two new lines: * - the first one indented which will hold the cursor * - the second one at the same indentation level */ - IndentOutdent, + IndentOutdent = 2, /** * Insert new line and outdent once (relative to the previous line's indentation). */ - Outdent + Outdent = 3 } /** diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 00e8ef06a0b..eab18a39e75 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -646,16 +646,16 @@ declare namespace vscode { /** * The range will be revealed with as little scrolling as possible. */ - Default, + Default = 0, /** * The range will always be revealed in the center of the viewport. */ - InCenter, + InCenter = 1, /** * If the range is outside the viewport, it will be revealed in the center of the viewport. * Otherwise, it will be revealed with as little scrolling as possible. */ - InCenterIfOutsideViewport + InCenterIfOutsideViewport = 2 } /** @@ -1660,17 +1660,17 @@ declare namespace vscode { /** * A textual occurrence. */ - Text, + Text = 0, /** * Read-access of a symbol, like reading a variable. */ - Read, + Read = 1, /** * Write-access of a symbol, like writing to a variable. */ - Write + Write = 2 } /** @@ -1722,27 +1722,27 @@ declare namespace vscode { * A symbol kind. */ export enum SymbolKind { - File, - Module, - Namespace, - Package, - Class, - Method, - Property, - Field, - Constructor, - Enum, - Interface, - Function, - Variable, - Constant, - String, - Number, - Boolean, - Array, - Object, - Key, - Null + File = 0, + Module = 1, + Namespace = 2, + Package = 3, + Class = 4, + Method = 5, + Property = 6, + Field = 7, + Constructor = 8, + Enum = 9, + Interface = 10, + Function = 11, + Variable = 12, + Constant = 13, + String = 14, + Number = 15, + Boolean = 16, + Array = 17, + Object = 18, + Key = 19, + Null = 20 } /** @@ -2208,24 +2208,24 @@ declare namespace vscode { * Completion item kinds. */ export enum CompletionItemKind { - Text, - Method, - Function, - Constructor, - Field, - Variable, - Class, - Interface, - Module, - Property, - Unit, - Value, - Enum, - Keyword, - Snippet, - Color, - File, - Reference + Text = 0, + Method = 1, + Function = 2, + Constructor = 3, + Field = 4, + Variable = 5, + Class = 6, + Interface = 7, + Module = 8, + Property = 9, + Unit = 10, + Value = 11, + Enum = 12, + Keyword = 13, + Snippet = 14, + Color = 15, + File = 16, + Reference = 17 } /** @@ -2499,21 +2499,21 @@ declare namespace vscode { /** * Insert new line and copy the previous line's indentation. */ - None, + None = 0, /** * Insert new line and indent once (relative to the previous line's indentation). */ - Indent, + Indent = 1, /** * Insert two new lines: * - the first one indented which will hold the cursor * - the second one at the same indentation level */ - IndentOutdent, + IndentOutdent = 2, /** * Insert new line and outdent once (relative to the previous line's indentation). */ - Outdent + Outdent = 3 } /** @@ -2928,12 +2928,12 @@ declare namespace vscode { /** * Aligned to the left side. */ - Left, + Left = 1, /** * Aligned to the right side. */ - Right + Right = 2 } /** diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 601ad8fc9a3..2615b5447b8 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -149,23 +149,23 @@ export class ExtHostAPIImplementation { this.Selection = extHostTypes.Selection; this.CancellationTokenSource = CancellationTokenSource; this.Hover = extHostTypes.Hover; - this.SymbolKind = extHostTypes.SymbolKind; - this.SymbolInformation = extHostTypes.SymbolInformation; - this.DocumentHighlightKind = extHostTypes.DocumentHighlightKind; - this.DocumentHighlight = extHostTypes.DocumentHighlight; + this.SymbolKind = extHostTypes.SymbolKind; + this.SymbolInformation = extHostTypes.SymbolInformation; + this.DocumentHighlightKind = extHostTypes.DocumentHighlightKind; + this.DocumentHighlight = extHostTypes.DocumentHighlight; this.CodeLens = extHostTypes.CodeLens; this.ParameterInformation = extHostTypes.ParameterInformation; this.SignatureInformation = extHostTypes.SignatureInformation; this.SignatureHelp = extHostTypes.SignatureHelp; - this.CompletionItem = extHostTypes.CompletionItem; - this.CompletionItemKind = extHostTypes.CompletionItemKind; + this.CompletionItem = extHostTypes.CompletionItem; + this.CompletionItemKind = extHostTypes.CompletionItemKind; this.CompletionList = extHostTypes.CompletionList; this.DocumentLink = extHostTypes.DocumentLink; this.ViewColumn = extHostTypes.ViewColumn; - this.StatusBarAlignment = extHostTypes.StatusBarAlignment; - this.IndentAction = Modes.IndentAction; + this.StatusBarAlignment = extHostTypes.StatusBarAlignment; + this.IndentAction = Modes.IndentAction; this.OverviewRulerLane = EditorCommon.OverviewRulerLane; - this.TextEditorRevealType = extHostTypes.TextEditorRevealType; + this.TextEditorRevealType = extHostTypes.TextEditorRevealType; this.EndOfLine = extHostTypes.EndOfLine; this.TextEditorCursorStyle = EditorCommon.TextEditorCursorStyle; this.TextEditorSelectionChangeKind = extHostTypes.TextEditorSelectionChangeKind; diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 47dc9dc80f1..62084d1a085 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -350,7 +350,7 @@ class ExtHostApiCommands { incomplete = item.container.incomplete || incomplete; items.push(typeConverters.Suggest.to(item.container, position, item.suggestion)); } - return new types.CompletionList(items, incomplete); + return new types.CompletionList(items, incomplete); } }); } diff --git a/src/vs/workbench/api/node/extHostLanguageFeatures.ts b/src/vs/workbench/api/node/extHostLanguageFeatures.ts index 3581d60e8e0..048d4738bd7 100644 --- a/src/vs/workbench/api/node/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/node/extHostLanguageFeatures.ts @@ -243,7 +243,7 @@ class DocumentHighlightAdapter { private static _convertDocumentHighlight(documentHighlight: vscode.DocumentHighlight): modes.DocumentHighlight { return { range: TypeConverters.fromRange(documentHighlight.range), - kind: documentHighlight.kind + kind: documentHighlight.kind }; } } @@ -583,8 +583,8 @@ class SuggestAdapter { if (!item) { return TPromise.as(suggestion); } - return asWinJsPromise(token => this._provider.resolveCompletionItem(item, token)).then(resolvedItem => { - return TypeConverters.Suggest.from(resolvedItem || item, this._disposables[id]); + return asWinJsPromise(token => this._provider.resolveCompletionItem(item, token)).then(resolvedItem => { + return TypeConverters.Suggest.from(resolvedItem || item, this._disposables[id]); }); } } diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index 69f9ad75684..4751ac893ec 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -220,7 +220,7 @@ export namespace SymbolInformation { export function toOutlineEntry(symbol: vscode.SymbolInformation): modes.SymbolInformation { return { name: symbol.name, - kind: symbol.kind, + kind: symbol.kind, containerName: symbol.containerName, location: { uri: symbol.location.uri, @@ -317,7 +317,7 @@ export const Suggest = { const suggestion: modes.ISuggestion = { label: item.label, insertText: item.insertText || item.label, - type: CompletionItemKind.from(item.kind), + type: CompletionItemKind.from(item.kind), detail: item.detail, documentation: item.documentation, sortText: item.sortText, diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index c175972fcd5..0d606e961dc 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -611,9 +611,9 @@ export class Hover { } export enum DocumentHighlightKind { - Text, - Read, - Write + Text = 0, + Read = 1, + Write = 2 } export class DocumentHighlight { @@ -745,24 +745,24 @@ export class SignatureHelp { } export enum CompletionItemKind { - Text, - Method, - Function, - Constructor, - Field, - Variable, - Class, - Interface, - Module, - Property, - Unit, - Value, - Enum, - Keyword, - Snippet, - Color, - File, - Reference + Text = 0, + Method = 1, + Function = 2, + Constructor = 3, + Field = 4, + Variable = 5, + Class = 6, + Interface = 7, + Module = 8, + Property = 9, + Unit = 10, + Value = 11, + Enum = 12, + Keyword = 13, + Snippet = 14, + Color = 15, + File = 16, + Reference = 17 } export class CompletionItem { diff --git a/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts b/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts index 0e420335c0a..8f2f0e6b2c7 100644 --- a/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts +++ b/src/vs/workbench/api/node/mainThreadLanguageFeatures.ts @@ -238,10 +238,10 @@ export class MainThreadLanguageFeatures extends MainThreadLanguageFeaturesShape $setLanguageConfiguration(handle: number, languageId: string, configuration: vscode.LanguageConfiguration): TPromise { if (configuration.__characterPairSupport) { - ( configuration).autoClosingPairs = configuration.__characterPairSupport.autoClosingPairs; + (configuration).autoClosingPairs = configuration.__characterPairSupport.autoClosingPairs; } - this._registrations[handle] = LanguageConfigurationRegistry.register(languageId, configuration); + this._registrations[handle] = LanguageConfigurationRegistry.register(languageId, configuration); return undefined; }