diff --git a/Gulpfile.ts b/Gulpfile.ts
index 054e99c8003..ef65454bc23 100644
--- a/Gulpfile.ts
+++ b/Gulpfile.ts
@@ -471,7 +471,10 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
js.pipe(prependCopyright())
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(".")),
- dts.pipe(prependCopyright())
+ dts.pipe(prependCopyright(/*outputCopyright*/true))
+ .pipe(insert.transform((content) => {
+ return content + "\r\nexport = ts;\r\nexport as namespace ts;";
+ }))
.pipe(gulp.dest("."))
]);
});
diff --git a/Jakefile.js b/Jakefile.js
index 3c26003fdf0..093d6f16893 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -183,23 +183,28 @@ var servicesSources = [
return path.join(servicesDirectory, f);
}));
-var serverCoreSources = [
- "types.d.ts",
- "shared.ts",
- "utilities.ts",
- "scriptVersionCache.ts",
- "typingsCache.ts",
- "scriptInfo.ts",
+var baseServerCoreSources = [
+ "editorServices.ts",
"lsHost.ts",
"project.ts",
- "editorServices.ts",
"protocol.ts",
+ "scriptInfo.ts",
+ "scriptVersionCache.ts",
"session.ts",
- "server.ts"
+ "shared.ts",
+ "types.ts",
+ "typingsCache.ts",
+ "utilities.ts",
].map(function (f) {
return path.join(serverDirectory, f);
});
+var serverCoreSources = [
+ "server.ts"
+].map(function (f) {
+ return path.join(serverDirectory, f);
+}).concat(baseServerCoreSources);
+
var cancellationTokenSources = [
"cancellationToken.ts"
].map(function (f) {
@@ -207,7 +212,7 @@ var cancellationTokenSources = [
});
var typingsInstallerSources = [
- "../types.d.ts",
+ "../types.ts",
"../shared.ts",
"typingsInstaller.ts",
"nodeTypingsInstaller.ts"
@@ -216,20 +221,7 @@ var typingsInstallerSources = [
});
var serverSources = serverCoreSources.concat(servicesSources);
-
-var languageServiceLibrarySources = [
- "protocol.ts",
- "utilities.ts",
- "scriptVersionCache.ts",
- "scriptInfo.ts",
- "lsHost.ts",
- "project.ts",
- "editorServices.ts",
- "session.ts",
-
-].map(function (f) {
- return path.join(serverDirectory, f);
-}).concat(servicesSources);
+var languageServiceLibrarySources = baseServerCoreSources.concat(servicesSources);
var harnessCoreSources = [
"harness.ts",
@@ -727,7 +719,18 @@ compileFile(
[builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets),
/*prefixes*/[copyright],
/*useBuiltCompiler*/ true,
- { noOutFile: false, generateDeclarations: true });
+ { noOutFile: false, generateDeclarations: true, stripInternal: true },
+ /*callback*/ function () {
+ prependFile(copyright, tsserverLibraryDefinitionFile);
+
+ // Appending exports at the end of the server library
+ var tsserverLibraryDefinitionFileContents =
+ fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
+ "\r\nexport = ts;" +
+ "\r\nexport as namespace ts;";
+
+ fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents);
+ });
// Local target to build the language service server library
desc("Builds language service server library");
diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts
index 00df53e1e35..38873a38aba 100644
--- a/src/server/editorServices.ts
+++ b/src/server/editorServices.ts
@@ -293,6 +293,7 @@ namespace ts.server {
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());
}
+ /* @internal */
getChangedFiles_TestOnly() {
return this.changedFiles;
}
@@ -1274,6 +1275,7 @@ namespace ts.server {
}
}
+ /* @internal */
synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[] {
const files: ProjectFilesWithTSDiagnostics[] = [];
this.collectChanges(knownProjects, this.externalProjects, files);
@@ -1282,6 +1284,7 @@ namespace ts.server {
return files;
}
+ /* @internal */
applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void {
const recordChangedFiles = changedFiles && !openFiles && !closedFiles;
if (openFiles) {
diff --git a/src/server/project.ts b/src/server/project.ts
index 6085ee05159..ff2dd582b89 100644
--- a/src/server/project.ts
+++ b/src/server/project.ts
@@ -58,6 +58,7 @@ namespace ts.server {
return counts.ts === 0 && counts.tsx === 0;
}
+ /* @internal */
export interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles {
projectErrors: Diagnostic[];
}
@@ -593,6 +594,7 @@ namespace ts.server {
return false;
}
+ /* @internal */
getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics {
this.updateGraph();
diff --git a/src/server/session.ts b/src/server/session.ts
index 5c382aae7d3..b8eeb9219db 100644
--- a/src/server/session.ts
+++ b/src/server/session.ts
@@ -88,50 +88,65 @@ namespace ts.server {
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";
@@ -140,19 +155,28 @@ namespace ts.server {
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";
}
diff --git a/src/server/shared.ts b/src/server/shared.ts
index c56d4098e75..77f66fc5a2d 100644
--- a/src/server/shared.ts
+++ b/src/server/shared.ts
@@ -1,4 +1,4 @@
-///
+///
namespace ts.server {
export const ActionSet: ActionSet = "action::set";
diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json
index 5483cc8ec28..76d700dd291 100644
--- a/src/server/tsconfig.library.json
+++ b/src/server/tsconfig.library.json
@@ -1,29 +1,30 @@
{
"compilerOptions": {
"noImplicitAny": true,
- "removeComments": true,
+ "noImplicitThis": true,
"preserveConstEnums": true,
+ "pretty": true,
"outFile": "../../built/local/tsserverlibrary.js",
"sourceMap": true,
"stripInternal": true,
- "declaration": true,
- "types": [],
"target": "es5",
"noUnusedLocals": true,
- "noUnusedParameters": true
+ "noUnusedParameters": true,
+ "declaration": true
},
"files": [
- "../services/shims.ts",
- "../services/utilities.ts",
- "shared.ts",
- "utilities.ts",
- "scriptVersionCache.ts",
- "scriptInfo.ts",
- "lshost.ts",
- "typingsCache.ts",
- "project.ts",
"editorServices.ts",
- "protocol.d.ts",
- "session.ts"
+ "lsHost.ts",
+ "project.ts",
+ "protocol.ts",
+ "scriptInfo.ts",
+ "scriptVersionCache.ts",
+ "session.ts",
+ "shared.ts",
+ "types.ts",
+ "typingsCache.ts",
+ "utilities.ts",
+ "../services/shims.ts",
+ "../services/utilities.ts"
]
}
diff --git a/src/server/types.d.ts b/src/server/types.ts
similarity index 96%
rename from src/server/types.d.ts
rename to src/server/types.ts
index 9f53fa8def1..2c18f275202 100644
--- a/src/server/types.d.ts
+++ b/src/server/types.ts
@@ -82,6 +82,7 @@ declare namespace ts.server {
readonly installSuccess: boolean;
}
+ /* @internal */
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
diff --git a/src/server/typingsInstaller/tsconfig.json b/src/server/typingsInstaller/tsconfig.json
index c6031b19aae..27f5cedc9d1 100644
--- a/src/server/typingsInstaller/tsconfig.json
+++ b/src/server/typingsInstaller/tsconfig.json
@@ -16,7 +16,7 @@
"noUnusedParameters": true
},
"files": [
- "../types.d.ts",
+ "../types.ts",
"../shared.ts",
"typingsInstaller.ts",
"nodeTypingsInstaller.ts"
diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts
index 7a09c1f6c21..f706943a0f5 100644
--- a/src/server/typingsInstaller/typingsInstaller.ts
+++ b/src/server/typingsInstaller/typingsInstaller.ts
@@ -1,7 +1,7 @@
///
///
///
-///
+///
///
namespace ts.server.typingsInstaller {
diff --git a/src/server/utilities.ts b/src/server/utilities.ts
index d0790b93dba..1889b055d29 100644
--- a/src/server/utilities.ts
+++ b/src/server/utilities.ts
@@ -1,4 +1,4 @@
-///
+///
///
namespace ts.server {