Skip to content

Commit 3a9a136

Browse files
committed
Changes based on feedback.
Whitespace cleanup. Switching back to protocol.ts and reenabling stripInternal. Marking internal symbols indirectly exported by dependencies of protocol.ts as internal.
1 parent b11c4be commit 3a9a136

File tree

7 files changed

+41
-11
lines changed

7 files changed

+41
-11
lines changed

Gulpfile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
473473
.pipe(gulp.dest(".")),
474474
dts.pipe(prependCopyright(/*outputCopyright*/true))
475475
.pipe(insert.transform((content) => {
476-
return content + "\r\nexport = ts;";
476+
return content + "\r\nexport = ts;\r\nexport as namespace ts;";
477477
}))
478478
.pipe(gulp.dest("."))
479479
]);

Jakefile.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,16 @@ compileFile(
719719
[builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets),
720720
/*prefixes*/[copyright],
721721
/*useBuiltCompiler*/ true,
722-
{ noOutFile: false, generateDeclarations: true },
723-
/*callback*/ function () {
724-
722+
{ noOutFile: false, generateDeclarations: true, stripInternal: true },
723+
/*callback*/ function () {
725724
prependFile(copyright, tsserverLibraryDefinitionFile);
726725

727-
// Appending 'export = ts;' at the end of the server library file to turn it into an external module
728-
var tsserverLibraryDefinitionFileContents = fs.readFileSync(tsserverLibraryDefinitionFile).toString() + "\r\nexport = ts;";
726+
// Appending exports at the end of the server library
727+
var tsserverLibraryDefinitionFileContents =
728+
fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
729+
"\r\nexport = ts;" +
730+
"\r\nexport as namespace ts;";
731+
729732
fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents);
730733
});
731734

src/server/editorServices.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ namespace ts.server {
293293
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());
294294
}
295295

296+
/* @internal */
296297
getChangedFiles_TestOnly() {
297298
return this.changedFiles;
298299
}
@@ -1274,6 +1275,7 @@ namespace ts.server {
12741275
}
12751276
}
12761277

1278+
/* @internal */
12771279
synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[] {
12781280
const files: ProjectFilesWithTSDiagnostics[] = [];
12791281
this.collectChanges(knownProjects, this.externalProjects, files);
@@ -1282,6 +1284,7 @@ namespace ts.server {
12821284
return files;
12831285
}
12841286

1287+
/* @internal */
12851288
applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void {
12861289
const recordChangedFiles = changedFiles && !openFiles && !closedFiles;
12871290
if (openFiles) {

src/server/project.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace ts.server {
5858
return counts.ts === 0 && counts.tsx === 0;
5959
}
6060

61+
/* @internal */
6162
export interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles {
6263
projectErrors: Diagnostic[];
6364
}
@@ -593,6 +594,7 @@ namespace ts.server {
593594
return false;
594595
}
595596

597+
/* @internal */
596598
getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics {
597599
this.updateGraph();
598600

src/server/session.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,50 +88,65 @@ namespace ts.server {
8888

8989
export namespace CommandNames {
9090
export const Brace: protocol.CommandTypes.Brace = "brace";
91+
/* @internal */
9192
export const BraceFull: protocol.CommandTypes.BraceFull = "brace-full";
9293
export const BraceCompletion: protocol.CommandTypes.BraceCompletion = "braceCompletion";
9394
export const Change: protocol.CommandTypes.Change = "change";
9495
export const Close: protocol.CommandTypes.Close = "close";
9596
export const Completions: protocol.CommandTypes.Completions = "completions";
97+
/* @internal */
9698
export const CompletionsFull: protocol.CommandTypes.CompletionsFull = "completions-full";
9799
export const CompletionDetails: protocol.CommandTypes.CompletionDetails = "completionEntryDetails";
98100
export const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList";
99101
export const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile = "compileOnSaveEmitFile";
100102
export const Configure: protocol.CommandTypes.Configure = "configure";
101103
export const Definition: protocol.CommandTypes.Definition = "definition";
104+
/* @internal */
102105
export const DefinitionFull: protocol.CommandTypes.DefinitionFull = "definition-full";
103106
export const Exit: protocol.CommandTypes.Exit = "exit";
104107
export const Format: protocol.CommandTypes.Format = "format";
105108
export const Formatonkey: protocol.CommandTypes.Formatonkey = "formatonkey";
109+
/* @internal */
106110
export const FormatFull: protocol.CommandTypes.FormatFull = "format-full";
111+
/* @internal */
107112
export const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull = "formatonkey-full";
113+
/* @internal */
108114
export const FormatRangeFull: protocol.CommandTypes.FormatRangeFull = "formatRange-full";
109115
export const Geterr: protocol.CommandTypes.Geterr = "geterr";
110116
export const GeterrForProject: protocol.CommandTypes.GeterrForProject = "geterrForProject";
111117
export const Implementation: protocol.CommandTypes.Implementation = "implementation";
118+
/* @internal */
112119
export const ImplementationFull: protocol.CommandTypes.ImplementationFull = "implementation-full";
113120
export const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync = "semanticDiagnosticsSync";
114121
export const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync";
115122
export const NavBar: protocol.CommandTypes.NavBar = "navbar";
123+
/* @internal */
116124
export const NavBarFull: protocol.CommandTypes.NavBarFull = "navbar-full";
117125
export const NavTree: protocol.CommandTypes.NavTree = "navtree";
118126
export const NavTreeFull: protocol.CommandTypes.NavTreeFull = "navtree-full";
119127
export const Navto: protocol.CommandTypes.Navto = "navto";
128+
/* @internal */
120129
export const NavtoFull: protocol.CommandTypes.NavtoFull = "navto-full";
121130
export const Occurrences: protocol.CommandTypes.Occurrences = "occurrences";
122131
export const DocumentHighlights: protocol.CommandTypes.DocumentHighlights = "documentHighlights";
132+
/* @internal */
123133
export const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull = "documentHighlights-full";
124134
export const Open: protocol.CommandTypes.Open = "open";
125135
export const Quickinfo: protocol.CommandTypes.Quickinfo = "quickinfo";
136+
/* @internal */
126137
export const QuickinfoFull: protocol.CommandTypes.QuickinfoFull = "quickinfo-full";
127138
export const References: protocol.CommandTypes.References = "references";
139+
/* @internal */
128140
export const ReferencesFull: protocol.CommandTypes.ReferencesFull = "references-full";
129141
export const Reload: protocol.CommandTypes.Reload = "reload";
130142
export const Rename: protocol.CommandTypes.Rename = "rename";
143+
/* @internal */
131144
export const RenameInfoFull: protocol.CommandTypes.RenameInfoFull = "rename-full";
145+
/* @internal */
132146
export const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull = "renameLocations-full";
133147
export const Saveto: protocol.CommandTypes.Saveto = "saveto";
134148
export const SignatureHelp: protocol.CommandTypes.SignatureHelp = "signatureHelp";
149+
/* @internal */
135150
export const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull = "signatureHelp-full";
136151
export const TypeDefinition: protocol.CommandTypes.TypeDefinition = "typeDefinition";
137152
export const ProjectInfo: protocol.CommandTypes.ProjectInfo = "projectInfo";
@@ -140,19 +155,28 @@ namespace ts.server {
140155
export const OpenExternalProject: protocol.CommandTypes.OpenExternalProject = "openExternalProject";
141156
export const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects = "openExternalProjects";
142157
export const CloseExternalProject: protocol.CommandTypes.CloseExternalProject = "closeExternalProject";
158+
/* @internal */
143159
export const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList = "synchronizeProjectList";
160+
/* @internal */
144161
export const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles = "applyChangedToOpenFiles";
162+
/* @internal */
145163
export const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full";
164+
/* @internal */
146165
export const Cleanup: protocol.CommandTypes.Cleanup = "cleanup";
166+
/* @internal */
147167
export const OutliningSpans: protocol.CommandTypes.OutliningSpans = "outliningSpans";
148168
export const TodoComments: protocol.CommandTypes.TodoComments = "todoComments";
149169
export const Indentation: protocol.CommandTypes.Indentation = "indentation";
150170
export const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate = "docCommentTemplate";
171+
/* @internal */
151172
export const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full";
173+
/* @internal */
152174
export const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan = "nameOrDottedNameSpan";
175+
/* @internal */
153176
export const BreakpointStatement: protocol.CommandTypes.BreakpointStatement = "breakpointStatement";
154177
export const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects";
155178
export const GetCodeFixes: protocol.CommandTypes.GetCodeFixes = "getCodeFixes";
179+
/* @internal */
156180
export const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull = "getCodeFixes-full";
157181
export const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes = "getSupportedCodeFixes";
158182
}

src/server/tsconfig.library.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
"compilerOptions": {
33
"noImplicitAny": true,
44
"noImplicitThis": true,
5-
"removeComments": false,
65
"preserveConstEnums": true,
76
"pretty": true,
87
"outFile": "../../built/local/tsserverlibrary.js",
98
"sourceMap": true,
10-
"types": [
11-
"node"
12-
],
9+
"stripInternal": true,
1310
"target": "es5",
1411
"noUnusedLocals": true,
1512
"noUnusedParameters": true,
@@ -19,7 +16,7 @@
1916
"editorServices.ts",
2017
"lsHost.ts",
2118
"project.ts",
22-
"protocol.d.ts",
19+
"protocol.ts",
2320
"scriptInfo.ts",
2421
"scriptVersionCache.ts",
2522
"session.ts",

src/server/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ declare namespace ts.server {
8282
readonly installSuccess: boolean;
8383
}
8484

85+
/* @internal */
8586
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
8687
writeFile(path: string, content: string): void;
8788
createDirectory(path: string): void;

0 commit comments

Comments
 (0)