Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -13,7 +13,6 @@ import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService';
import { StaticServices } from 'vs/editor/standalone/browser/standaloneServices';
import * as modes from 'vs/editor/common/modes';
import { LanguageConfiguration, IndentAction } from 'vs/editor/common/modes/languageConfiguration';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -24,6 +23,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
import { IMarkerData } from 'vs/platform/markers/common/markers';
import { Token, TokenizationResult, TokenizationResult2 } from 'vs/editor/common/core/token';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
import * as model from 'vs/editor/common/model';
/**
* Register information about a new language.
@@ -263,7 +263,7 @@ export function registerSignatureHelpProvider(languageId: string, provider: mode
*/
export function registerHoverProvider(languageId: string, provider: modes.HoverProvider): IDisposable {
return modes.HoverProviderRegistry.register(languageId, {
provideHover: (model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): Thenable<modes.Hover> => {
provideHover: (model: model.ITextModel, position: Position, token: CancellationToken): Thenable<modes.Hover> => {
let word = model.getWordAtPosition(position);
return toThenable<modes.Hover>(provider.provideHover(model, position, token)).then((value) => {
@@ -329,11 +329,11 @@ export function registerCodeLensProvider(languageId: string, provider: modes.Cod
*/
export function registerCodeActionProvider(languageId: string, provider: CodeActionProvider): IDisposable {
return modes.CodeActionProviderRegistry.register(languageId, {
provideCodeActions: (model: editorCommon.IReadOnlyModel, range: Range, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]> => {
provideCodeActions: (model: model.ITextModel, range: Range, context: modes.CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]> => {
let markers = StaticServices.markerService.get().read({ resource: model.uri }).filter(m => {
return Range.areIntersectingOrTouching(m, range);
});
return provider.provideCodeActions(model, range, { markers }, token);
return provider.provideCodeActions(model, range, { markers, only: context.only }, token);
}
});
}
@@ -373,10 +373,10 @@ export function registerCompletionItemProvider(languageId: string, provider: Com
let adapter = new SuggestAdapter(provider);
return modes.SuggestRegistry.register(languageId, {
triggerCharacters: provider.triggerCharacters,
provideCompletionItems: (model: editorCommon.IReadOnlyModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
provideCompletionItems: (model: model.ITextModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> => {
return adapter.provideCompletionItems(model, position, context, token);
},
resolveCompletionItem: (model: editorCommon.IReadOnlyModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
resolveCompletionItem: (model: model.ITextModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> => {
return adapter.resolveCompletionItem(model, position, suggestion, token);
}
});
@@ -389,6 +389,14 @@ export function registerColorProvider(languageId: string, provider: modes.Docume
return modes.ColorProviderRegistry.register(languageId, provider);
}
/**
* Register a folding provider
*/
/*export function registerFoldingProvider(languageId: string, provider: modes.FoldingProvider): IDisposable {
return modes.FoldingProviderRegistry.register(languageId, provider);
}*/
/**
* Contains additional diagnostic information about the context in which
* a [code action](#CodeActionProvider.provideCodeActions) is run.
@@ -401,6 +409,11 @@ export interface CodeActionContext {
* @readonly
*/
readonly markers: IMarkerData[];
/**
* Requested kind of actions to return.
*/
readonly only?: string;
}
/**
@@ -411,7 +424,7 @@ export interface CodeActionProvider {
/**
* Provide commands for the given document and range.
*/
provideCodeActions(model: editorCommon.IReadOnlyModel, range: Range, context: CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]>;
provideCodeActions(model: model.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (modes.Command | modes.CodeAction)[] | Thenable<(modes.Command | modes.CodeAction)[]>;
}
/**
@@ -524,7 +537,19 @@ export interface CompletionItem {
* ~~The [range](#Range) of the edit must be single-line and on the same
* line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~
*/
textEdit?: editorCommon.ISingleEditOperation;
textEdit?: model.ISingleEditOperation;
/**
* An optional array of additional text edits that are applied when
* selecting this completion. Edits must not overlap with the main edit
* nor with themselves.
*/
additionalTextEdits?: model.ISingleEditOperation[];
/**
* An optional set of characters that when pressed while this completion is active will accept it first and
* then type that character. *Note* that all commit characters should have `length=1` and that superfluous
* characters will be ignored.
*/
commitCharacters?: string[];
}
/**
* Represents a collection of [completion items](#CompletionItem) to be presented
@@ -576,7 +601,7 @@ export interface CompletionItemProvider {
/**
* Provide completion items for the given position and document.
*/
provideCompletionItems(document: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
provideCompletionItems(document: model.ITextModel, position: Position, token: CancellationToken, context: CompletionContext): CompletionItem[] | Thenable<CompletionItem[]> | CompletionList | Thenable<CompletionList>;
/**
* Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
@@ -634,7 +659,9 @@ class SuggestAdapter {
command: item.command,
sortText: item.sortText,
filterText: item.filterText,
snippetType: 'internal'
snippetType: 'internal',
additionalTextEdits: item.additionalTextEdits,
commitCharacters: item.commitCharacters
};
let editRange = item.textEdit ? item.textEdit.range : item.range;
if (editRange) {
@@ -665,7 +692,7 @@ class SuggestAdapter {
return suggestion;
}
provideCompletionItems(model: editorCommon.IReadOnlyModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> {
provideCompletionItems(model: model.ITextModel, position: Position, context: modes.SuggestContext, token: CancellationToken): Thenable<modes.ISuggestResult> {
const result = this._provider.provideCompletionItems(model, position, token, context);
return toThenable<CompletionItem[] | CompletionList>(result).then(value => {
const result: modes.ISuggestResult = {
@@ -708,7 +735,7 @@ class SuggestAdapter {
});
}
resolveCompletionItem(model: editorCommon.IReadOnlyModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> {
resolveCompletionItem(model: model.ITextModel, position: Position, suggestion: modes.ISuggestion, token: CancellationToken): Thenable<modes.ISuggestion> {
if (typeof this._provider.resolveCompletionItem !== 'function') {
return TPromise.as(suggestion);
}