mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
docCommentTemplate
This commit is contained in:
parent
061bb0f9e5
commit
cd1efd5109
@ -148,6 +148,7 @@ namespace ts.server {
|
||||
export const OutliningSpans = "outliningSpans";
|
||||
export const TodoComments = "todoComments";
|
||||
export const Indentation = "indentation";
|
||||
export const DocCommentTemplate = "docCommentTemplate";
|
||||
}
|
||||
|
||||
namespace Errors {
|
||||
@ -713,6 +714,13 @@ namespace ts.server {
|
||||
return project.languageService.getTodoComments(file, args.descriptors);
|
||||
}
|
||||
|
||||
private getDocCommentTemplate(args: protocol.FileLocationRequestArgs) {
|
||||
const { file, project } = this.getFileAndProject(args.file);
|
||||
const scriptInfo = project.getScriptInfo(file);
|
||||
const position = this.getPosition(args, scriptInfo);
|
||||
return project.languageService.getDocCommentTemplateAtPosition(file, position);
|
||||
}
|
||||
|
||||
private getIndentation(args: protocol.IndentationRequestArgs) {
|
||||
const { file, project } = this.getFileAndProject(args.file);
|
||||
const position = this.getPosition(args, project.getScriptInfo(file));
|
||||
@ -1271,6 +1279,9 @@ namespace ts.server {
|
||||
[CommandNames.Indentation]: (request: protocol.IndentationRequest) => {
|
||||
return this.requiredResponse(this.getIndentation(request.arguments));
|
||||
},
|
||||
[CommandNames.DocCommentTemplate]: (request: protocol.FileLocationRequest) => {
|
||||
return this.requiredResponse(this.getDocCommentTemplate(request.arguments));
|
||||
},
|
||||
[CommandNames.Format]: (request: protocol.Request) => {
|
||||
const formatArgs = <protocol.FormatRequestArgs>request.arguments;
|
||||
return this.requiredResponse(this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user