mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Added simplified result to ToggleComment
This commit is contained in:
parent
e5829881b5
commit
937e3e88e1
@ -2196,20 +2196,32 @@ namespace ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
private toggleLineComment(args: protocol.ToggleLineCommentRequestArgs, simplifiedResult: boolean) {
|
||||
private toggleLineComment(args: protocol.ToggleLineCommentRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
|
||||
const result = project.getLanguageService().toggleLineComment(file, args.textRanges);
|
||||
const textChanges = project.getLanguageService().toggleLineComment(file, args.textRanges);
|
||||
|
||||
return simplifiedResult ? [] : result;
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
}
|
||||
|
||||
private toggleMultilineComment(args: protocol.ToggleMultilineCommentRequestArgs, simplifiedResult: boolean) {
|
||||
private toggleMultilineComment(args: protocol.ToggleMultilineCommentRequestArgs, simplifiedResult: boolean): TextChange[] | protocol.CodeEdit[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
|
||||
const result = project.getLanguageService().toggleMultilineComment(file, args.textRanges);
|
||||
const textChanges = project.getLanguageService().toggleMultilineComment(file, args.textRanges);
|
||||
|
||||
return simplifiedResult ? [] : result;
|
||||
if (simplifiedResult) {
|
||||
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file)!;
|
||||
|
||||
return textChanges.map(textChange => this.convertTextChangeToCodeEdit(textChange, scriptInfo));
|
||||
}
|
||||
|
||||
return textChanges;
|
||||
}
|
||||
|
||||
private mapSelectionRange(selectionRange: SelectionRange, scriptInfo: ScriptInfo): protocol.SelectionRange {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user