Also convert ClassificationTypeNames and CommandTypes/CommandNames

This commit is contained in:
Andy Hanson
2017-05-22 10:40:59 -07:00
parent b162097c3c
commit f94818da36
5 changed files with 163 additions and 255 deletions

View File

@@ -2,103 +2,103 @@
* Declaration module describing the TypeScript Server protocol
*/
namespace ts.server.protocol {
export namespace CommandTypes {
export type Brace = "brace";
export enum CommandTypes {
Brace = "brace",
/* @internal */
export type BraceFull = "brace-full";
export type BraceCompletion = "braceCompletion";
export type Change = "change";
export type Close = "close";
export type Completions = "completions";
BraceFull = "brace-full",
BraceCompletion = "braceCompletion",
Change = "change",
Close = "close",
Completions = "completions",
/* @internal */
export type CompletionsFull = "completions-full";
export type CompletionDetails = "completionEntryDetails";
export type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
export type CompileOnSaveEmitFile = "compileOnSaveEmitFile";
export type Configure = "configure";
export type Definition = "definition";
CompletionsFull = "completions-full",
CompletionDetails = "completionEntryDetails",
CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList",
CompileOnSaveEmitFile = "compileOnSaveEmitFile",
Configure = "configure",
Definition = "definition",
/* @internal */
export type DefinitionFull = "definition-full";
export type Implementation = "implementation";
DefinitionFull = "definition-full",
Implementation = "implementation",
/* @internal */
export type ImplementationFull = "implementation-full";
export type Exit = "exit";
export type Format = "format";
export type Formatonkey = "formatonkey";
ImplementationFull = "implementation-full",
Exit = "exit",
Format = "format",
Formatonkey = "formatonkey",
/* @internal */
export type FormatFull = "format-full";
FormatFull = "format-full",
/* @internal */
export type FormatonkeyFull = "formatonkey-full";
FormatonkeyFull = "formatonkey-full",
/* @internal */
export type FormatRangeFull = "formatRange-full";
export type Geterr = "geterr";
export type GeterrForProject = "geterrForProject";
export type SemanticDiagnosticsSync = "semanticDiagnosticsSync";
export type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
export type NavBar = "navbar";
FormatRangeFull = "formatRange-full",
Geterr = "geterr",
GeterrForProject = "geterrForProject",
SemanticDiagnosticsSync = "semanticDiagnosticsSync",
SyntacticDiagnosticsSync = "syntacticDiagnosticsSync",
NavBar = "navbar",
/* @internal */
export type NavBarFull = "navbar-full";
export type Navto = "navto";
NavBarFull = "navbar-full",
Navto = "navto",
/* @internal */
export type NavtoFull = "navto-full";
export type NavTree = "navtree";
export type NavTreeFull = "navtree-full";
export type Occurrences = "occurrences";
export type DocumentHighlights = "documentHighlights";
NavtoFull = "navto-full",
NavTree = "navtree",
NavTreeFull = "navtree-full",
Occurrences = "occurrences",
DocumentHighlights = "documentHighlights",
/* @internal */
export type DocumentHighlightsFull = "documentHighlights-full";
export type Open = "open";
export type Quickinfo = "quickinfo";
DocumentHighlightsFull = "documentHighlights-full",
Open = "open",
Quickinfo = "quickinfo",
/* @internal */
export type QuickinfoFull = "quickinfo-full";
export type References = "references";
QuickinfoFull = "quickinfo-full",
References = "references",
/* @internal */
export type ReferencesFull = "references-full";
export type Reload = "reload";
export type Rename = "rename";
ReferencesFull = "references-full",
Reload = "reload",
Rename = "rename",
/* @internal */
export type RenameInfoFull = "rename-full";
RenameInfoFull = "rename-full",
/* @internal */
export type RenameLocationsFull = "renameLocations-full";
export type Saveto = "saveto";
export type SignatureHelp = "signatureHelp";
RenameLocationsFull = "renameLocations-full",
Saveto = "saveto",
SignatureHelp = "signatureHelp",
/* @internal */
export type SignatureHelpFull = "signatureHelp-full";
export type TypeDefinition = "typeDefinition";
export type ProjectInfo = "projectInfo";
export type ReloadProjects = "reloadProjects";
export type Unknown = "unknown";
export type OpenExternalProject = "openExternalProject";
export type OpenExternalProjects = "openExternalProjects";
export type CloseExternalProject = "closeExternalProject";
SignatureHelpFull = "signatureHelp-full",
TypeDefinition = "typeDefinition",
ProjectInfo = "projectInfo",
ReloadProjects = "reloadProjects",
Unknown = "unknown",
OpenExternalProject = "openExternalProject",
OpenExternalProjects = "openExternalProjects",
CloseExternalProject = "closeExternalProject",
/* @internal */
export type SynchronizeProjectList = "synchronizeProjectList";
SynchronizeProjectList = "synchronizeProjectList",
/* @internal */
export type ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
ApplyChangedToOpenFiles = "applyChangedToOpenFiles",
/* @internal */
export type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full",
/* @internal */
export type Cleanup = "cleanup";
Cleanup = "cleanup",
/* @internal */
export type OutliningSpans = "outliningSpans";
export type TodoComments = "todoComments";
export type Indentation = "indentation";
export type DocCommentTemplate = "docCommentTemplate";
OutliningSpans = "outliningSpans",
TodoComments = "todoComments",
Indentation = "indentation",
DocCommentTemplate = "docCommentTemplate",
/* @internal */
export type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full",
/* @internal */
export type NameOrDottedNameSpan = "nameOrDottedNameSpan";
NameOrDottedNameSpan = "nameOrDottedNameSpan",
/* @internal */
export type BreakpointStatement = "breakpointStatement";
export type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
export type GetCodeFixes = "getCodeFixes";
BreakpointStatement = "breakpointStatement",
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
GetCodeFixes = "getCodeFixes",
/* @internal */
export type GetCodeFixesFull = "getCodeFixes-full";
export type GetSupportedCodeFixes = "getSupportedCodeFixes";
GetCodeFixesFull = "getCodeFixes-full",
GetSupportedCodeFixes = "getSupportedCodeFixes",
export type GetApplicableRefactors = "getApplicableRefactors";
export type GetRefactorCodeActions = "getRefactorCodeActions";
export type GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
GetApplicableRefactors = "getApplicableRefactors",
GetRefactorCodeActions = "getRefactorCodeActions",
GetRefactorCodeActionsFull = "getRefactorCodeActions-full",
}
/**

View File

@@ -112,104 +112,7 @@ namespace ts.server {
return true;
}
export namespace CommandNames {
export const Brace: protocol.CommandTypes.Brace = "brace";
/* @internal */
export const BraceFull: protocol.CommandTypes.BraceFull = "brace-full";
export const BraceCompletion: protocol.CommandTypes.BraceCompletion = "braceCompletion";
export const Change: protocol.CommandTypes.Change = "change";
export const Close: protocol.CommandTypes.Close = "close";
export const Completions: protocol.CommandTypes.Completions = "completions";
/* @internal */
export const CompletionsFull: protocol.CommandTypes.CompletionsFull = "completions-full";
export const CompletionDetails: protocol.CommandTypes.CompletionDetails = "completionEntryDetails";
export const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
export const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile = "compileOnSaveEmitFile";
export const Configure: protocol.CommandTypes.Configure = "configure";
export const Definition: protocol.CommandTypes.Definition = "definition";
/* @internal */
export const DefinitionFull: protocol.CommandTypes.DefinitionFull = "definition-full";
export const Exit: protocol.CommandTypes.Exit = "exit";
export const Format: protocol.CommandTypes.Format = "format";
export const Formatonkey: protocol.CommandTypes.Formatonkey = "formatonkey";
/* @internal */
export const FormatFull: protocol.CommandTypes.FormatFull = "format-full";
/* @internal */
export const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull = "formatonkey-full";
/* @internal */
export const FormatRangeFull: protocol.CommandTypes.FormatRangeFull = "formatRange-full";
export const Geterr: protocol.CommandTypes.Geterr = "geterr";
export const GeterrForProject: protocol.CommandTypes.GeterrForProject = "geterrForProject";
export const Implementation: protocol.CommandTypes.Implementation = "implementation";
/* @internal */
export const ImplementationFull: protocol.CommandTypes.ImplementationFull = "implementation-full";
export const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync = "semanticDiagnosticsSync";
export const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
export const NavBar: protocol.CommandTypes.NavBar = "navbar";
/* @internal */
export const NavBarFull: protocol.CommandTypes.NavBarFull = "navbar-full";
export const NavTree: protocol.CommandTypes.NavTree = "navtree";
export const NavTreeFull: protocol.CommandTypes.NavTreeFull = "navtree-full";
export const Navto: protocol.CommandTypes.Navto = "navto";
/* @internal */
export const NavtoFull: protocol.CommandTypes.NavtoFull = "navto-full";
export const Occurrences: protocol.CommandTypes.Occurrences = "occurrences";
export const DocumentHighlights: protocol.CommandTypes.DocumentHighlights = "documentHighlights";
/* @internal */
export const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull = "documentHighlights-full";
export const Open: protocol.CommandTypes.Open = "open";
export const Quickinfo: protocol.CommandTypes.Quickinfo = "quickinfo";
/* @internal */
export const QuickinfoFull: protocol.CommandTypes.QuickinfoFull = "quickinfo-full";
export const References: protocol.CommandTypes.References = "references";
/* @internal */
export const ReferencesFull: protocol.CommandTypes.ReferencesFull = "references-full";
export const Reload: protocol.CommandTypes.Reload = "reload";
export const Rename: protocol.CommandTypes.Rename = "rename";
/* @internal */
export const RenameInfoFull: protocol.CommandTypes.RenameInfoFull = "rename-full";
/* @internal */
export const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull = "renameLocations-full";
export const Saveto: protocol.CommandTypes.Saveto = "saveto";
export const SignatureHelp: protocol.CommandTypes.SignatureHelp = "signatureHelp";
/* @internal */
export const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull = "signatureHelp-full";
export const TypeDefinition: protocol.CommandTypes.TypeDefinition = "typeDefinition";
export const ProjectInfo: protocol.CommandTypes.ProjectInfo = "projectInfo";
export const ReloadProjects: protocol.CommandTypes.ReloadProjects = "reloadProjects";
export const Unknown: protocol.CommandTypes.Unknown = "unknown";
export const OpenExternalProject: protocol.CommandTypes.OpenExternalProject = "openExternalProject";
export const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects = "openExternalProjects";
export const CloseExternalProject: protocol.CommandTypes.CloseExternalProject = "closeExternalProject";
/* @internal */
export const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList = "synchronizeProjectList";
/* @internal */
export const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
/* @internal */
export const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
/* @internal */
export const Cleanup: protocol.CommandTypes.Cleanup = "cleanup";
/* @internal */
export const OutliningSpans: protocol.CommandTypes.OutliningSpans = "outliningSpans";
export const TodoComments: protocol.CommandTypes.TodoComments = "todoComments";
export const Indentation: protocol.CommandTypes.Indentation = "indentation";
export const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate = "docCommentTemplate";
/* @internal */
export const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
/* @internal */
export const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan = "nameOrDottedNameSpan";
/* @internal */
export const BreakpointStatement: protocol.CommandTypes.BreakpointStatement = "breakpointStatement";
export const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
export const GetCodeFixes: protocol.CommandTypes.GetCodeFixes = "getCodeFixes";
/* @internal */
export const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull = "getCodeFixes-full";
export const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes = "getSupportedCodeFixes";
export const GetApplicableRefactors: protocol.CommandTypes.GetApplicableRefactors = "getApplicableRefactors";
export const GetRefactorCodeActions: protocol.CommandTypes.GetRefactorCodeActions = "getRefactorCodeActions";
export const GetRefactorCodeActionsFull: protocol.CommandTypes.GetRefactorCodeActionsFull = "getRefactorCodeActions-full";
}
export import CommandNames = protocol.CommandTypes;
export function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string {
const verboseLogging = logger.hasLevel(LogLevel.verbose);