From 9c124b3c0d85879506c307e700c10aeb63a68640 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sun, 19 Jun 2016 15:57:02 -0700 Subject: [PATCH] nameOrDottedSpan --- src/server/session.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/session.ts b/src/server/session.ts index e20811a0c1b..4bd6f26d482 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -152,6 +152,7 @@ namespace ts.server { export const DocCommentTemplate = "docCommentTemplate"; export const SyntacticDiagnosticsFull = "syntacticDiagnostics-full"; export const CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; + export const NameOrDottedNameSpan = "nameOrDottedNameSpan"; } namespace Errors { @@ -752,6 +753,12 @@ namespace ts.server { return { position, indentation }; } + private getNameOrDottedNameSpan(args: protocol.FileLocationRequestArgs) { + const { file, project } = this.getFileAndProject(args.file); + const position = this.getPosition(args, project.getScriptInfo(file)); + return project.languageService.getNameOrDottedNameSpan(file, position, position); + } + private isValidBraceCompletion(args: protocol.BraceCompletionRequestArgs) { const { file, project } = this.getFileAndProject(args.file); const position = this.getPosition(args, project.getScriptInfo(file)); @@ -1309,6 +1316,9 @@ namespace ts.server { [CommandNames.Indentation]: (request: protocol.IndentationRequest) => { return this.requiredResponse(this.getIndentation(request.arguments)); }, + [CommandNames.NameOrDottedNameSpan]: (request: protocol.FileLocationRequest) => { + return this.requiredResponse(this.getNameOrDottedNameSpan(request.arguments)); + }, [CommandNames.BraceCompletion]: (request: protocol.BraceCompletionRequest) => { return this.requiredResponse(this.isValidBraceCompletion(request.arguments)); },