mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 22:15:05 -05:00
generate protocol on fly
This commit is contained in:
@@ -2574,11 +2574,7 @@ namespace ts {
|
||||
NodeJs = 2
|
||||
}
|
||||
|
||||
export type RootPaths = string[];
|
||||
export type PathSubstitutions = MapLike<string[]>;
|
||||
export type TsConfigOnlyOptions = RootPaths | PathSubstitutions;
|
||||
|
||||
export type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions;
|
||||
export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]>;
|
||||
|
||||
export interface CompilerOptions {
|
||||
allowJs?: boolean;
|
||||
@@ -2629,14 +2625,14 @@ namespace ts {
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
outFile?: string;
|
||||
paths?: PathSubstitutions;
|
||||
paths?: MapLike<string[]>;
|
||||
preserveConstEnums?: boolean;
|
||||
project?: string;
|
||||
/* @internal */ pretty?: DiagnosticStyle;
|
||||
reactNamespace?: string;
|
||||
removeComments?: boolean;
|
||||
rootDir?: string;
|
||||
rootDirs?: RootPaths;
|
||||
rootDirs?: string[];
|
||||
skipLibCheck?: boolean;
|
||||
skipDefaultLibCheck?: boolean;
|
||||
sourceMap?: boolean;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/// <reference path="..\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="protocol.d.ts" />
|
||||
/// <reference path="session.ts" />
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/// <reference path="..\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="protocol.d.ts" />
|
||||
/// <reference path="utilities.ts" />
|
||||
/// <reference path="session.ts" />
|
||||
/// <reference path="scriptVersionCache.ts"/>
|
||||
|
||||
@@ -1,7 +1,90 @@
|
||||
/**
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
declare namespace ts.server.protocol {
|
||||
namespace ts.server.protocol {
|
||||
export namespace CommandNames {
|
||||
export const Brace = "brace";
|
||||
/* @internal */
|
||||
export const BraceFull = "brace-full";
|
||||
export const BraceCompletion = "braceCompletion";
|
||||
export const Change = "change";
|
||||
export const Close = "close";
|
||||
export const Completions = "completions";
|
||||
/* @internal */
|
||||
export const CompletionsFull = "completions-full";
|
||||
export const CompletionDetails = "completionEntryDetails";
|
||||
export const CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
export const CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
export const Configure = "configure";
|
||||
export const Definition = "definition";
|
||||
/* @internal */
|
||||
export const DefinitionFull = "definition-full";
|
||||
export const Exit = "exit";
|
||||
export const Format = "format";
|
||||
export const Formatonkey = "formatonkey";
|
||||
/* @internal */
|
||||
export const FormatFull = "format-full";
|
||||
/* @internal */
|
||||
export const FormatonkeyFull = "formatonkey-full";
|
||||
/* @internal */
|
||||
export const FormatRangeFull = "formatRange-full";
|
||||
export const Geterr = "geterr";
|
||||
export const GeterrForProject = "geterrForProject";
|
||||
export const SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
export const SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
export const NavBar = "navbar";
|
||||
/* @internal */
|
||||
export const NavBarFull = "navbar-full";
|
||||
export const Navto = "navto";
|
||||
/* @internal */
|
||||
export const NavtoFull = "navto-full";
|
||||
export const Occurrences = "occurrences";
|
||||
export const DocumentHighlights = "documentHighlights";
|
||||
/* @internal */
|
||||
export const DocumentHighlightsFull = "documentHighlights-full";
|
||||
export const Open = "open";
|
||||
export const Quickinfo = "quickinfo";
|
||||
/* @internal */
|
||||
export const QuickinfoFull = "quickinfo-full";
|
||||
export const References = "references";
|
||||
/* @internal */
|
||||
export const ReferencesFull = "references-full";
|
||||
export const Reload = "reload";
|
||||
export const Rename = "rename";
|
||||
/* @internal */
|
||||
export const RenameInfoFull = "rename-full";
|
||||
/* @internal */
|
||||
export const RenameLocationsFull = "renameLocations-full";
|
||||
export const Saveto = "saveto";
|
||||
export const SignatureHelp = "signatureHelp";
|
||||
/* @internal */
|
||||
export const SignatureHelpFull = "signatureHelp-full";
|
||||
export const TypeDefinition = "typeDefinition";
|
||||
export const ProjectInfo = "projectInfo";
|
||||
export const ReloadProjects = "reloadProjects";
|
||||
export const Unknown = "unknown";
|
||||
export const OpenExternalProject = "openExternalProject";
|
||||
export const OpenExternalProjects = "openExternalProjects";
|
||||
export const CloseExternalProject = "closeExternalProject";
|
||||
export const SynchronizeProjectList = "synchronizeProjectList";
|
||||
/* @internal */
|
||||
export const ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
|
||||
/* @internal */
|
||||
export const EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
|
||||
export const Cleanup = "cleanup";
|
||||
export const OutliningSpans = "outliningSpans";
|
||||
export const TodoComments = "todoComments";
|
||||
export const Indentation = "indentation";
|
||||
export const DocCommentTemplate = "docCommentTemplate";
|
||||
/* @internal */
|
||||
export const CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
|
||||
/* @internal */
|
||||
export const NameOrDottedNameSpan = "nameOrDottedNameSpan";
|
||||
/* @internal */
|
||||
export const BreakpointStatement = "breakpointStatement";
|
||||
export const CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
}
|
||||
|
||||
/**
|
||||
* A TypeScript Server message
|
||||
*/
|
||||
@@ -190,16 +273,17 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The line number for the request (1-based).
|
||||
*/
|
||||
line?: number;
|
||||
line: number;
|
||||
|
||||
/**
|
||||
* The character offset (on the line) for the request (1-based).
|
||||
*/
|
||||
offset?: number;
|
||||
offset: number;
|
||||
|
||||
/**
|
||||
* Position (can be specified instead of line/offset pair)
|
||||
*/
|
||||
/* @internal */
|
||||
position?: number;
|
||||
}
|
||||
|
||||
@@ -539,70 +623,12 @@ declare namespace ts.server.protocol {
|
||||
projectErrors: DiagnosticWithLinePosition[];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface ChangedOpenFile {
|
||||
fileName: string;
|
||||
changes: ts.TextChange[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Editor options
|
||||
*/
|
||||
export interface EditorOptions {
|
||||
|
||||
/** Number of spaces for each tab. Default value is 4. */
|
||||
tabSize?: number;
|
||||
|
||||
/** Number of spaces to indent during formatting. Default value is 4. */
|
||||
indentSize?: number;
|
||||
|
||||
/** Number of additional spaces to indent during formatting to preserve base indentation (ex. script block indentation). Default value is 0. */
|
||||
baseIndentSize?: number;
|
||||
|
||||
/** The new line character to be used. Default value is the OS line delimiter. */
|
||||
newLineCharacter?: string;
|
||||
|
||||
/** Whether tabs should be converted to spaces. Default value is true. */
|
||||
convertTabsToSpaces?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format options
|
||||
*/
|
||||
export interface FormatOptions extends EditorOptions {
|
||||
|
||||
/** Defines space handling after a comma delimiter. Default value is true. */
|
||||
insertSpaceAfterCommaDelimiter?: boolean;
|
||||
|
||||
/** Defines space handling after a semicolon in a for statement. Default value is true */
|
||||
insertSpaceAfterSemicolonInForStatements?: boolean;
|
||||
|
||||
/** Defines space handling after a binary operator. Default value is true. */
|
||||
insertSpaceBeforeAndAfterBinaryOperators?: boolean;
|
||||
|
||||
/** Defines space handling after keywords in control flow statement. Default value is true. */
|
||||
insertSpaceAfterKeywordsInControlFlowStatements?: boolean;
|
||||
|
||||
/** Defines space handling after function keyword for anonymous functions. Default value is false. */
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
|
||||
|
||||
/** Defines space handling after opening and before closing non empty parenthesis. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
|
||||
|
||||
/** Defines space handling after opening and before closing non empty brackets. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
|
||||
|
||||
/** Defines space handling before and after template string braces. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
|
||||
|
||||
/** Defines space handling before and after JSX expression braces. Default value is false. */
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
|
||||
|
||||
/** Defines whether an open brace is put onto a new line for functions or not. Default value is false. */
|
||||
placeOpenBraceOnNewLineForFunctions?: boolean;
|
||||
|
||||
/** Defines whether an open brace is put onto a new line for control blocks or not. Default value is false. */
|
||||
placeOpenBraceOnNewLineForControlBlocks?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information found in a configure request.
|
||||
@@ -623,7 +649,7 @@ declare namespace ts.server.protocol {
|
||||
/**
|
||||
* The format options to use during formatting and other code editing features.
|
||||
*/
|
||||
formatOptions?: FormatOptions;
|
||||
formatOptions?: FormatCodeSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -669,7 +695,7 @@ declare namespace ts.server.protocol {
|
||||
arguments: OpenRequestArgs;
|
||||
}
|
||||
|
||||
type OpenExternalProjectArgs = ExternalProject;
|
||||
export type OpenExternalProjectArgs = ExternalProject;
|
||||
|
||||
export interface OpenExternalProjectRequest extends Request {
|
||||
arguments: OpenExternalProjectArgs;
|
||||
@@ -699,10 +725,12 @@ declare namespace ts.server.protocol {
|
||||
knownProjects: protocol.ProjectVersionInfo[];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface ApplyChangedToOpenFilesRequest extends Request {
|
||||
arguments: ApplyChangedToOpenFilesRequestArgs;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface ApplyChangedToOpenFilesRequestArgs {
|
||||
openFiles?: ExternalFile[];
|
||||
changedFiles?: ChangedOpenFile[];
|
||||
@@ -820,7 +848,7 @@ declare namespace ts.server.protocol {
|
||||
endOffset: number;
|
||||
|
||||
endPosition?: number;
|
||||
options?: ts.FormatCodeOptions;
|
||||
options?: FormatCodeSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -875,7 +903,7 @@ declare namespace ts.server.protocol {
|
||||
*/
|
||||
key: string;
|
||||
|
||||
options?: ts.FormatCodeOptions;
|
||||
options?: FormatCodeSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ namespace ts.server {
|
||||
return this.containingProjects[0];
|
||||
}
|
||||
|
||||
setFormatOptions(formatSettings: protocol.FormatOptions): void {
|
||||
setFormatOptions(formatSettings: FormatCodeSettings): void {
|
||||
if (formatSettings) {
|
||||
if (!this.formatCodeSettings) {
|
||||
this.formatCodeSettings = getDefaultFormatCodeSettings(this.host);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/// <reference path="..\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="protocol.d.ts" />
|
||||
/// <reference path="session.ts" />
|
||||
|
||||
namespace ts.server {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="..\compiler\commandLineParser.ts" />
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="protocol.d.ts" />
|
||||
/// <reference path="protocol.ts" />
|
||||
/// <reference path="editorServices.ts" />
|
||||
|
||||
namespace ts.server {
|
||||
@@ -70,69 +70,7 @@ namespace ts.server {
|
||||
return true;
|
||||
}
|
||||
|
||||
export namespace CommandNames {
|
||||
export const Brace = "brace";
|
||||
export const BraceFull = "brace-full";
|
||||
export const BraceCompletion = "braceCompletion";
|
||||
export const Change = "change";
|
||||
export const Close = "close";
|
||||
export const Completions = "completions";
|
||||
export const CompletionsFull = "completions-full";
|
||||
export const CompletionDetails = "completionEntryDetails";
|
||||
export const CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
|
||||
export const CompileOnSaveEmitFile = "compileOnSaveEmitFile";
|
||||
export const Configure = "configure";
|
||||
export const Definition = "definition";
|
||||
export const DefinitionFull = "definition-full";
|
||||
export const Exit = "exit";
|
||||
export const Format = "format";
|
||||
export const Formatonkey = "formatonkey";
|
||||
export const FormatFull = "format-full";
|
||||
export const FormatonkeyFull = "formatonkey-full";
|
||||
export const FormatRangeFull = "formatRange-full";
|
||||
export const Geterr = "geterr";
|
||||
export const GeterrForProject = "geterrForProject";
|
||||
export const SemanticDiagnosticsSync = "semanticDiagnosticsSync";
|
||||
export const SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
|
||||
export const NavBar = "navbar";
|
||||
export const NavBarFull = "navbar-full";
|
||||
export const Navto = "navto";
|
||||
export const NavtoFull = "navto-full";
|
||||
export const Occurrences = "occurrences";
|
||||
export const DocumentHighlights = "documentHighlights";
|
||||
export const DocumentHighlightsFull = "documentHighlights-full";
|
||||
export const Open = "open";
|
||||
export const Quickinfo = "quickinfo";
|
||||
export const QuickinfoFull = "quickinfo-full";
|
||||
export const References = "references";
|
||||
export const ReferencesFull = "references-full";
|
||||
export const Reload = "reload";
|
||||
export const Rename = "rename";
|
||||
export const RenameInfoFull = "rename-full";
|
||||
export const RenameLocationsFull = "renameLocations-full";
|
||||
export const Saveto = "saveto";
|
||||
export const SignatureHelp = "signatureHelp";
|
||||
export const SignatureHelpFull = "signatureHelp-full";
|
||||
export const TypeDefinition = "typeDefinition";
|
||||
export const ProjectInfo = "projectInfo";
|
||||
export const ReloadProjects = "reloadProjects";
|
||||
export const Unknown = "unknown";
|
||||
export const OpenExternalProject = "openExternalProject";
|
||||
export const OpenExternalProjects = "openExternalProjects";
|
||||
export const CloseExternalProject = "closeExternalProject";
|
||||
export const SynchronizeProjectList = "synchronizeProjectList";
|
||||
export const ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
|
||||
export const EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
|
||||
export const Cleanup = "cleanup";
|
||||
export const OutliningSpans = "outliningSpans";
|
||||
export const TodoComments = "todoComments";
|
||||
export const Indentation = "indentation";
|
||||
export const DocCommentTemplate = "docCommentTemplate";
|
||||
export const CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
|
||||
export const NameOrDottedNameSpan = "nameOrDottedNameSpan";
|
||||
export const BreakpointStatement = "breakpointStatement";
|
||||
export const CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
|
||||
}
|
||||
import CommandNames = protocol.CommandNames;
|
||||
|
||||
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);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"typingsCache.ts",
|
||||
"project.ts",
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"protocol.ts",
|
||||
"session.ts",
|
||||
"server.ts"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user