Skip to content

Commit

Permalink
final touch at heap service removal, #74846
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 19, 2019
1 parent a409cd2 commit c8843e3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 50 deletions.
36 changes: 1 addition & 35 deletions src/vs/workbench/api/common/extHostCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class CommandsConverter {
this._commands.registerCommand(true, this._delegatingCommandId, this._executeConvertedCommand, this);
}

toInternal2(command: vscode.Command | undefined, disposables: DisposableStore): CommandDto | undefined {
toInternal(command: vscode.Command | undefined, disposables: DisposableStore): CommandDto | undefined {

if (!command) {
return undefined;
Expand Down Expand Up @@ -240,40 +240,6 @@ export class CommandsConverter {
return result;
}

toInternal(command: vscode.Command): CommandDto;
toInternal(command: undefined): undefined;
toInternal(command: vscode.Command | undefined): CommandDto | undefined;
toInternal(command: vscode.Command | undefined): CommandDto | undefined {

if (!command) {
return undefined;
}

const result: CommandDto = {
$ident: undefined,
id: command.command,
title: command.title,
};

if (command.command && isNonEmptyArray(command.arguments)) {
// we have a contributed command with arguments. that
// means we don't want to send the arguments around

const id = ++this._cachIdPool;
this._cache.set(id, command);
result.$ident = id;

result.id = this._delegatingCommandId;
result.arguments = [id];
}

if (command.tooltip) {
result.tooltip = command.tooltip;
}

return result;
}

fromInternal(command: modes.Command): vscode.Command | undefined {

const id = ObjectIdentifier.of(command);
Expand Down
14 changes: 7 additions & 7 deletions src/vs/workbench/api/common/extHostComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,9 @@ export class ExtHostCommentThread implements vscode.CommentThread {
const label = this.label;
const contextValue = this.contextValue;
const comments = this._comments.map(cmt => { return convertToModeComment2(this, this._commentController, cmt, this._commandsConverter, this._commentsMap, this._acceptInputDisposables.value!); });
const acceptInputCommand = this._acceptInputCommand ? this._commandsConverter.toInternal2(this._acceptInputCommand, this._acceptInputDisposables.value) : undefined;
const additionalCommands = (this._additionalCommands ? this._additionalCommands.map(x => this._commandsConverter.toInternal2(x, this._acceptInputDisposables.value!)) : []) as CommandDto[];
const deleteCommand = this._deleteCommand ? this._commandsConverter.toInternal2(this._deleteCommand, this._acceptInputDisposables.value) : undefined;
const acceptInputCommand = this._acceptInputCommand ? this._commandsConverter.toInternal(this._acceptInputCommand, this._acceptInputDisposables.value) : undefined;
const additionalCommands = (this._additionalCommands ? this._additionalCommands.map(x => this._commandsConverter.toInternal(x, this._acceptInputDisposables.value!)) : []) as CommandDto[];
const deleteCommand = this._deleteCommand ? this._commandsConverter.toInternal(this._deleteCommand, this._acceptInputDisposables.value) : undefined;
const collapsibleState = convertToCollapsibleState(this._collapseState);

this._proxy.$updateCommentThread(
Expand Down Expand Up @@ -951,9 +951,9 @@ function convertToModeComment2(thread: ExtHostCommentThread, commentController:
userName: vscodeComment.author ? vscodeComment.author.name : vscodeComment.userName,
userIconPath: iconPath,
isDraft: vscodeComment.isDraft,
selectCommand: vscodeComment.selectCommand ? commandsConverter.toInternal2(vscodeComment.selectCommand, disposables) : undefined,
editCommand: vscodeComment.editCommand ? commandsConverter.toInternal2(vscodeComment.editCommand, disposables) : undefined,
deleteCommand: vscodeComment.deleteCommand ? commandsConverter.toInternal2(vscodeComment.deleteCommand, disposables) : undefined,
selectCommand: vscodeComment.selectCommand ? commandsConverter.toInternal(vscodeComment.selectCommand, disposables) : undefined,
editCommand: vscodeComment.editCommand ? commandsConverter.toInternal(vscodeComment.editCommand, disposables) : undefined,
deleteCommand: vscodeComment.deleteCommand ? commandsConverter.toInternal(vscodeComment.deleteCommand, disposables) : undefined,
label: vscodeComment.label,
commentReactions: reactions ? reactions.map(reaction => convertToReaction2(commentController.reactionProvider, reaction)) : undefined
};
Expand All @@ -971,7 +971,7 @@ function convertToComment(provider: vscode.DocumentCommentProvider | vscode.Work
userIconPath: iconPath,
canEdit: canEdit,
canDelete: canDelete,
selectCommand: vscodeComment.command ? commandsConverter.toInternal2(vscodeComment.command, disposables) : undefined,
selectCommand: vscodeComment.command ? commandsConverter.toInternal(vscodeComment.command, disposables) : undefined,
isDraft: vscodeComment.isDraft,
commentReactions: vscodeComment.commentReactions ? vscodeComment.commentReactions.map(reaction => convertToReaction(provider, reaction)) : undefined
};
Expand Down
10 changes: 5 additions & 5 deletions src/vs/workbench/api/common/extHostLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class CodeLensAdapter {
result.lenses.push({
cacheId: [cacheId, i],
range: typeConvert.Range.from(lenses[i].range),
command: this._commands.toInternal2(lenses[i].command, disposables)
command: this._commands.toInternal(lenses[i].command, disposables)
});
}

Expand Down Expand Up @@ -167,7 +167,7 @@ class CodeLensAdapter {
}

newLens = newLens || lens;
symbol.command = this._commands.toInternal2(newLens.command || CodeLensAdapter._badCmd, disposables);
symbol.command = this._commands.toInternal(newLens.command || CodeLensAdapter._badCmd, disposables);
return symbol;
});
}
Expand Down Expand Up @@ -368,7 +368,7 @@ class CodeActionAdapter {
actions.push({
_isSynthetic: true,
title: candidate.title,
command: this._commands.toInternal2(candidate, disposables),
command: this._commands.toInternal(candidate, disposables),
});
} else {
if (codeActionContext.only) {
Expand All @@ -382,7 +382,7 @@ class CodeActionAdapter {
// new school: convert code action
actions.push({
title: candidate.title,
command: candidate.command && this._commands.toInternal2(candidate.command, disposables),
command: candidate.command && this._commands.toInternal(candidate.command, disposables),
diagnostics: candidate.diagnostics && candidate.diagnostics.map(typeConvert.Diagnostic.from),
edit: candidate.edit && typeConvert.WorkspaceEdit.from(candidate.edit),
kind: candidate.kind && candidate.kind.value,
Expand Down Expand Up @@ -735,7 +735,7 @@ class SuggestAdapter {
i: item.keepWhitespace ? modes.CompletionItemInsertTextRule.KeepWhitespace : 0,
k: item.commitCharacters,
l: item.additionalTextEdits && item.additionalTextEdits.map(typeConvert.TextEdit.from),
m: this._commands.toInternal2(item.command, disposables),
m: this._commands.toInternal(item.command, disposables),
};

// 'insertText'-logic
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostSCM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class ExtHostSourceControl implements vscode.SourceControl {

this._acceptInputCommand = acceptInputCommand;

const internal = this._commands.converter.toInternal2(acceptInputCommand, this._acceptInputDisposables.value);
const internal = this._commands.converter.toInternal(acceptInputCommand, this._acceptInputDisposables.value);
this._proxy.$updateSourceControl(this.handle, { acceptInputCommand: internal });
}

Expand All @@ -447,7 +447,7 @@ class ExtHostSourceControl implements vscode.SourceControl {

this._statusBarCommands = statusBarCommands;

const internal = (statusBarCommands || []).map(c => this._commands.converter.toInternal2(c, this._statusBarDisposables.value!)) as CommandDto[];
const internal = (statusBarCommands || []).map(c => this._commands.converter.toInternal(c, this._statusBarDisposables.value!)) as CommandDto[];
this._proxy.$updateSourceControl(this.handle, { statusBarCommands: internal });
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTreeViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class ExtHostTreeView<T> extends Disposable {
description: extensionTreeItem.description,
resourceUri: extensionTreeItem.resourceUri,
tooltip: typeof extensionTreeItem.tooltip === 'string' ? extensionTreeItem.tooltip : undefined,
command: extensionTreeItem.command ? this.commands.toInternal2(extensionTreeItem.command, disposable) : undefined,
command: extensionTreeItem.command ? this.commands.toInternal(extensionTreeItem.command, disposable) : undefined,
contextValue: extensionTreeItem.contextValue,
icon,
iconDark: this.getDarkIconPath(extensionTreeItem) || icon,
Expand Down

0 comments on commit c8843e3

Please sign in to comment.