mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Removed public commands
This commit is contained in:
parent
89429ac6aa
commit
40751ba89b
@ -136,16 +136,12 @@ namespace ts.server.protocol {
|
||||
SelectionRange = "selectionRange",
|
||||
/* @internal */
|
||||
SelectionRangeFull = "selectionRange-full",
|
||||
ToggleLineComment = "toggleLineComment",
|
||||
/* @internal */
|
||||
ToggleLineCommentFull = "toggleLineComment-full",
|
||||
ToggleMultilineComment = "toggleMultilineComment",
|
||||
/* @internal */
|
||||
ToggleMultilineCommentFull = "toggleMultilineComment-full",
|
||||
CommentSelection = "commentSelection",
|
||||
/* @internal */
|
||||
CommentSelectionFull = "commentSelection-full",
|
||||
UncommentSelection = "uncommentSelection",
|
||||
/* @internal */
|
||||
UncommentSelectionFull = "uncommentSelection-full",
|
||||
PrepareCallHierarchy = "prepareCallHierarchy",
|
||||
@ -1544,23 +1540,8 @@ namespace ts.server.protocol {
|
||||
parent?: SelectionRange;
|
||||
}
|
||||
|
||||
export interface ToggleLineCommentRequest extends FileRequest {
|
||||
command: CommandTypes.ToggleLineComment;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
|
||||
export interface ToggleMultilineCommentRequest extends FileRequest {
|
||||
command: CommandTypes.ToggleMultilineComment;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
|
||||
export interface CommentSelectionRequest extends FileRequest {
|
||||
command: CommandTypes.CommentSelection;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
|
||||
export interface UncommentSelectionRequest extends FileRequest {
|
||||
command: CommandTypes.UncommentSelection;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
|
||||
|
||||
@ -2201,68 +2201,36 @@ namespace ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
private toggleLineComment(args: protocol.FileRangeRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
private toggleLineComment(args: protocol.FileRangeRequestArgs): TextChange[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
|
||||
const textRange = this.getRange(args, scriptInfo);
|
||||
|
||||
const textChanges = project.getLanguageService().toggleLineComment(file, textRange);
|
||||
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
return project.getLanguageService().toggleLineComment(file, textRange);
|
||||
}
|
||||
|
||||
private toggleMultilineComment(args: protocol.FileRangeRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
private toggleMultilineComment(args: protocol.FileRangeRequestArgs): TextChange[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
|
||||
const textRange = this.getRange(args, scriptInfo);
|
||||
|
||||
const textChanges = project.getLanguageService().toggleMultilineComment(file, textRange);
|
||||
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
return project.getLanguageService().toggleMultilineComment(file, textRange);
|
||||
}
|
||||
|
||||
private commentSelection(args: protocol.FileRangeRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
private commentSelection(args: protocol.FileRangeRequestArgs): TextChange[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
|
||||
const textRange = this.getRange(args, scriptInfo);
|
||||
|
||||
const textChanges = project.getLanguageService().commentSelection(file, textRange);
|
||||
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
return project.getLanguageService().commentSelection(file, textRange);
|
||||
}
|
||||
|
||||
private uncommentSelection(args: protocol.FileRangeRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
private uncommentSelection(args: protocol.FileRangeRequestArgs): TextChange[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
|
||||
const textRange = this.getRange(args, scriptInfo);
|
||||
|
||||
const textChanges = project.getLanguageService().uncommentSelection(file, textRange);
|
||||
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
return project.getLanguageService().uncommentSelection(file, textRange);
|
||||
}
|
||||
|
||||
private mapSelectionRange(selectionRange: SelectionRange, scriptInfo: ScriptInfo): protocol.SelectionRange {
|
||||
@ -2710,29 +2678,17 @@ namespace ts.server {
|
||||
[CommandNames.ProvideCallHierarchyOutgoingCalls]: (request: protocol.ProvideCallHierarchyOutgoingCallsRequest) => {
|
||||
return this.requiredResponse(this.provideCallHierarchyOutgoingCalls(request.arguments));
|
||||
},
|
||||
[CommandNames.ToggleLineComment]: (request: protocol.ToggleLineCommentRequest) => {
|
||||
return this.requiredResponse(this.toggleLineComment(request.arguments, /*simplifiedResult*/ true));
|
||||
[CommandNames.ToggleLineCommentFull]: (request: protocol.CommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.toggleLineComment(request.arguments));
|
||||
},
|
||||
[CommandNames.ToggleLineCommentFull]: (request: protocol.ToggleLineCommentRequest) => {
|
||||
return this.requiredResponse(this.toggleLineComment(request.arguments, /*simplifiedResult*/ false));
|
||||
},
|
||||
[CommandNames.ToggleMultilineComment]: (request: protocol.ToggleMultilineCommentRequest) => {
|
||||
return this.requiredResponse(this.toggleMultilineComment(request.arguments, /*simplifiedResult*/ true));
|
||||
},
|
||||
[CommandNames.ToggleMultilineCommentFull]: (request: protocol.ToggleMultilineCommentRequest) => {
|
||||
return this.requiredResponse(this.toggleMultilineComment(request.arguments, /*simplifiedResult*/ false));
|
||||
},
|
||||
[CommandNames.CommentSelection]: (request: protocol.CommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.commentSelection(request.arguments, /*simplifiedResult*/ true));
|
||||
[CommandNames.ToggleMultilineCommentFull]: (request: protocol.CommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.toggleMultilineComment(request.arguments));
|
||||
},
|
||||
[CommandNames.CommentSelectionFull]: (request: protocol.CommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.commentSelection(request.arguments, /*simplifiedResult*/ false));
|
||||
return this.requiredResponse(this.commentSelection(request.arguments));
|
||||
},
|
||||
[CommandNames.UncommentSelection]: (request: protocol.UncommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.uncommentSelection(request.arguments, /*simplifiedResult*/ true));
|
||||
},
|
||||
[CommandNames.UncommentSelectionFull]: (request: protocol.UncommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.uncommentSelection(request.arguments, /*simplifiedResult*/ false));
|
||||
[CommandNames.UncommentSelectionFull]: (request: protocol.CommentSelectionRequest) => {
|
||||
return this.requiredResponse(this.uncommentSelection(request.arguments));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -272,10 +272,10 @@ namespace ts.server {
|
||||
CommandNames.PrepareCallHierarchy,
|
||||
CommandNames.ProvideCallHierarchyIncomingCalls,
|
||||
CommandNames.ProvideCallHierarchyOutgoingCalls,
|
||||
CommandNames.ToggleLineComment,
|
||||
CommandNames.ToggleMultilineComment,
|
||||
CommandNames.CommentSelection,
|
||||
CommandNames.UncommentSelection,
|
||||
CommandNames.ToggleLineCommentFull,
|
||||
CommandNames.ToggleMultilineCommentFull,
|
||||
CommandNames.CommentSelectionFull,
|
||||
CommandNames.UncommentSelectionFull,
|
||||
];
|
||||
|
||||
it("should not throw when commands are executed with invalid arguments", () => {
|
||||
|
||||
@ -6304,10 +6304,6 @@ declare namespace ts.server.protocol {
|
||||
GetEditsForFileRename = "getEditsForFileRename",
|
||||
ConfigurePlugin = "configurePlugin",
|
||||
SelectionRange = "selectionRange",
|
||||
ToggleLineComment = "toggleLineComment",
|
||||
ToggleMultilineComment = "toggleMultilineComment",
|
||||
CommentSelection = "commentSelection",
|
||||
UncommentSelection = "uncommentSelection",
|
||||
PrepareCallHierarchy = "prepareCallHierarchy",
|
||||
ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
|
||||
ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls"
|
||||
@ -7332,20 +7328,7 @@ declare namespace ts.server.protocol {
|
||||
textSpan: TextSpan;
|
||||
parent?: SelectionRange;
|
||||
}
|
||||
interface ToggleLineCommentRequest extends FileRequest {
|
||||
command: CommandTypes.ToggleLineComment;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
interface ToggleMultilineCommentRequest extends FileRequest {
|
||||
command: CommandTypes.ToggleMultilineComment;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
interface CommentSelectionRequest extends FileRequest {
|
||||
command: CommandTypes.CommentSelection;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
interface UncommentSelectionRequest extends FileRequest {
|
||||
command: CommandTypes.UncommentSelection;
|
||||
arguments: FileRangeRequestArgs;
|
||||
}
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user