Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533 (#6932)

* Merge from vscode e3b9b8eefc062d68ba8a4b6a817162d132f3b533

* skip failing test

* add comment
This commit is contained in:
Anthony Dresser
2019-08-24 00:19:48 -07:00
committed by GitHub
parent 023d06d114
commit 92a3acbfe8
77 changed files with 992 additions and 559 deletions

View File

@@ -21,7 +21,6 @@ import { Selection } from 'vs/editor/common/core/selection';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import * as callh from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { mixin } from 'vs/base/common/objects';
import { fromArray } from 'vs/base/common/map';
@extHostNamedCustomer(MainContext.MainThreadLanguageFeatures)
export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape {
@@ -331,7 +330,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return {
label: data.a,
kind: data.b,
kindModifier: data.n && fromArray(data.n),
tags: data.n,
detail: data.c,
documentation: data.d,
sortText: data.e,

View File

@@ -544,9 +544,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
};
// namespace: workspace
let warnedRootPathDeprecated = false;
const workspace: typeof vscode.workspace = {
get rootPath() {
console.warn(`[Deprecation Warning] 'workspace.rootPath' is deprecated and should no longer be used. Please use 'workspace.workspaceFolders' instead. (${extension.publisher}.${extension.name})`);
if (extension.isUnderDevelopment && !warnedRootPathDeprecated) {
warnedRootPathDeprecated = true;
console.warn(`[Deprecation Warning] 'workspace.rootPath' is deprecated and should no longer be used. Please use 'workspace.workspaceFolders' instead. More details: https://aka.ms/vscode-eliminating-rootpath`);
}
return extHostWorkspace.getPath();
},
set rootPath(value) {
@@ -815,7 +820,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
CommentMode: extHostTypes.CommentMode,
CompletionItem: extHostTypes.CompletionItem,
CompletionItemKind: extHostTypes.CompletionItemKind,
CompletionItemKindModifier: extHostTypes.CompletionItemKindModifier,
CompletionItemTag: extHostTypes.CompletionItemTag,
CompletionList: extHostTypes.CompletionList,
CompletionTriggerKind: extHostTypes.CompletionTriggerKind,
ConfigurationTarget: extHostTypes.ConfigurationTarget,
@@ -870,6 +875,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
StatusBarAlignment: extHostTypes.StatusBarAlignment,
SymbolInformation: extHostTypes.SymbolInformation,
SymbolKind: extHostTypes.SymbolKind,
SymbolTag: extHostTypes.SymbolTag,
Task: extHostTypes.Task,
Task2: extHostTypes.Task,
TaskGroup: extHostTypes.TaskGroup,

View File

@@ -940,7 +940,7 @@ export interface ISuggestDataDto {
k/* commitCharacters */?: string[];
l/* additionalTextEdits */?: ISingleEditOperation[];
m/* command */?: modes.Command;
n/* kindModifier */?: modes.CompletionItemKindModifier[];
n/* kindModifier */?: modes.CompletionItemTag[];
// not-standard
x?: ChainedCacheId;
}

View File

@@ -70,8 +70,8 @@ class DocumentSymbolAdapter {
const element = <modes.DocumentSymbol>{
name: info.name || '!!MISSING: name!!',
kind: typeConvert.SymbolKind.from(info.kind),
kindTags: [],
detail: undefined!, // Strict null override — avoid changing behavior
tags: info.tags && info.tags.map(typeConvert.SymbolTag.from),
detail: '',
containerName: info.containerName,
range: typeConvert.Range.from(info.location.range),
selectionRange: typeConvert.Range.from(info.location.range),
@@ -728,6 +728,7 @@ class SuggestAdapter {
//
a: item.label,
b: typeConvert.CompletionItemKind.from(item.kind),
n: item.tags && item.tags.map(typeConvert.CompletionItemTag.from),
c: item.detail,
d: typeof item.documentation === 'undefined' ? undefined : typeConvert.MarkdownString.fromStrict(item.documentation),
e: item.sortText,
@@ -739,12 +740,6 @@ class SuggestAdapter {
m: this._commands.toInternal(item.command, disposables),
};
// kind2
if (typeof item.kind2 === 'object') {
result.b = typeConvert.CompletionItemKind.from(item.kind2.base);
result.n = item.kind2.modifier.map(typeConvert.CompletionItemKindModifier.from);
}
// 'insertText'-logic
if (item.textEdit) {
result.h = item.textEdit.newText;

View File

@@ -28,7 +28,7 @@ import * as marked from 'vs/base/common/marked/marked';
import { parse } from 'vs/base/common/marshalling';
import { cloneAndChange } from 'vs/base/common/objects';
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
import { coalesce } from 'vs/base/common/arrays';
import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
import { RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
export interface PositionLike {
@@ -556,22 +556,40 @@ export namespace SymbolKind {
}
}
export namespace SymbolTag {
export function from(kind: types.SymbolTag): modes.SymbolTag {
switch (kind) {
case types.SymbolTag.Deprecated: return modes.SymbolTag.Deprecated;
}
}
export function to(kind: modes.SymbolTag): types.SymbolTag {
switch (kind) {
case modes.SymbolTag.Deprecated: return types.SymbolTag.Deprecated;
}
}
}
export namespace WorkspaceSymbol {
export function from(info: vscode.SymbolInformation): search.IWorkspaceSymbol {
return <search.IWorkspaceSymbol>{
name: info.name,
kind: SymbolKind.from(info.kind),
tags: info.tags && info.tags.map(SymbolTag.from),
containerName: info.containerName,
location: location.from(info.location)
};
}
export function to(info: search.IWorkspaceSymbol): types.SymbolInformation {
return new types.SymbolInformation(
const result = new types.SymbolInformation(
info.name,
SymbolKind.to(info.kind),
info.containerName,
location.to(info.location)
);
result.tags = info.tags && info.tags.map(SymbolTag.to);
return result;
}
}
@@ -583,7 +601,7 @@ export namespace DocumentSymbol {
range: Range.from(info.range),
selectionRange: Range.from(info.selectionRange),
kind: SymbolKind.from(info.kind),
kindTags: []
tags: info.tags ? info.tags.map(SymbolTag.from) : []
};
if (info.children) {
result.children = info.children.map(from);
@@ -598,6 +616,9 @@ export namespace DocumentSymbol {
Range.to(info.range),
Range.to(info.selectionRange),
);
if (isNonEmptyArray(info.tags)) {
result.tags = info.tags.map(SymbolTag.to);
}
if (info.children) {
result.children = info.children.map(to) as any;
}
@@ -682,17 +703,17 @@ export namespace CompletionContext {
}
}
export namespace CompletionItemKindModifier {
export namespace CompletionItemTag {
export function from(kind: types.CompletionItemKindModifier): modes.CompletionItemKindModifier {
export function from(kind: types.CompletionItemTag): modes.CompletionItemTag {
switch (kind) {
case types.CompletionItemKindModifier.Deprecated: return modes.CompletionItemKindModifier.Deprecated;
case types.CompletionItemTag.Deprecated: return modes.CompletionItemTag.Deprecated;
}
}
export function to(kind: modes.CompletionItemKindModifier): types.CompletionItemKindModifier {
export function to(kind: modes.CompletionItemTag): types.CompletionItemTag {
switch (kind) {
case modes.CompletionItemKindModifier.Deprecated: return types.CompletionItemKindModifier.Deprecated;
case modes.CompletionItemTag.Deprecated: return types.CompletionItemTag.Deprecated;
}
}
}
@@ -768,6 +789,7 @@ export namespace CompletionItem {
const result = new types.CompletionItem(suggestion.label);
result.insertText = suggestion.insertText;
result.kind = CompletionItemKind.to(suggestion.kind);
result.tags = suggestion.tags && suggestion.tags.map(CompletionItemTag.to);
result.detail = suggestion.detail;
result.documentation = htmlContent.isMarkdownString(suggestion.documentation) ? MarkdownString.to(suggestion.documentation) : suggestion.documentation;
result.sortText = suggestion.sortText;

View File

@@ -979,6 +979,10 @@ export enum SymbolKind {
TypeParameter = 25
}
export enum SymbolTag {
Deprecated = 1,
}
@es5ClassCompat
export class SymbolInformation {
@@ -991,6 +995,7 @@ export class SymbolInformation {
name: string;
location!: Location;
kind: SymbolKind;
tags?: SymbolTag[];
containerName: string | undefined;
constructor(name: string, kind: SymbolKind, containerName: string | undefined, location: Location);
@@ -1041,6 +1046,7 @@ export class DocumentSymbol {
name: string;
detail: string;
kind: SymbolKind;
tags?: SymbolTag[];
range: Range;
selectionRange: Range;
children: DocumentSymbol[];
@@ -1308,7 +1314,7 @@ export enum CompletionItemKind {
TypeParameter = 24
}
export enum CompletionItemKindModifier {
export enum CompletionItemTag {
Deprecated = 1,
}
@@ -1317,7 +1323,7 @@ export class CompletionItem implements vscode.CompletionItem {
label: string;
kind?: CompletionItemKind;
kind2?: CompletionItemKind | { base: CompletionItemKind, modifier: CompletionItemKindModifier[] };
tags?: CompletionItemTag[];
detail?: string;
documentation?: string | MarkdownString;
sortText?: string;

View File

@@ -299,7 +299,24 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
}
public $onDidChangeWebviewPanelViewStates(newStates: WebviewPanelViewStateData): void {
for (const handle of Object.keys(newStates)) {
const handles = Object.keys(newStates);
// Notify webviews of state changes in the following order:
// - Non-visible
// - Visible
// - Active
handles.sort((a, b) => {
const stateA = newStates[a];
const stateB = newStates[b];
if (stateA.active) {
return 1;
}
if (stateB.active) {
return -1;
}
return (+stateA.visible) - (+stateB.visible);
});
for (const handle of handles) {
const panel = this.getWebviewPanel(handle);
if (!panel || panel._isDisposed) {
continue;