Skip to content

Commit d2ec45f

Browse files
author
Andy
authored
Remove unnecessary 'ts.' qualifications (#17163)
1 parent fd2dd2e commit d2ec45f

10 files changed

+75
-75
lines changed

src/server/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ namespace ts.server {
227227
}));
228228
}
229229

230-
getFormattingEditsForRange(file: string, start: number, end: number, _options: ts.FormatCodeOptions): ts.TextChange[] {
230+
getFormattingEditsForRange(file: string, start: number, end: number, _options: FormatCodeOptions): ts.TextChange[] {
231231
const args: protocol.FormatRequestArgs = this.createFileLocationRequestArgsWithEndLineAndOffset(file, start, end);
232232

233233

src/server/editorServices.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace ts.server {
4545
* Any compiler options that might contain paths will be taken out.
4646
* Enum compiler options will be converted to strings.
4747
*/
48-
readonly compilerOptions: ts.CompilerOptions;
48+
readonly compilerOptions: CompilerOptions;
4949
// "extends", "files", "include", or "exclude" will be undefined if an external config is used.
5050
// Otherwise, we will use "true" if the property is present and "false" if it is missing.
5151
readonly extends: boolean | undefined;
@@ -201,7 +201,7 @@ namespace ts.server {
201201
* This helper function processes a list of projects and return the concatenated, sortd and deduplicated output of processing each project.
202202
*/
203203
export function combineProjectOutput<T>(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean) {
204-
const result = ts.flatMap(projects, action).sort(comparer);
204+
const result = flatMap(projects, action).sort(comparer);
205205
return projects.length > 1 ? deduplicate(result, areEqual) : result;
206206
}
207207

@@ -240,7 +240,7 @@ namespace ts.server {
240240
getFileName: x => x,
241241
getScriptKind: _ => undefined,
242242
hasMixedContent: (fileName, extraFileExtensions) => {
243-
const mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, item => item.isMixedContent), item => item.extension);
243+
const mixedContentExtensions = map(filter(extraFileExtensions, item => item.isMixedContent), item => item.extension);
244244
return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension));
245245
}
246246
};
@@ -633,7 +633,7 @@ namespace ts.server {
633633
// If a change was made inside "folder/file", node will trigger the callback twice:
634634
// one with the fileName being "folder/file", and the other one with "folder".
635635
// We don't respond to the second one.
636-
if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) {
636+
if (fileName && !isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) {
637637
return;
638638
}
639639

@@ -1082,7 +1082,7 @@ namespace ts.server {
10821082
configFileName: configFileName(),
10831083
projectType: project instanceof server.ExternalProject ? "external" : "configured",
10841084
languageServiceEnabled: project.languageServiceEnabled,
1085-
version: ts.version,
1085+
version,
10861086
};
10871087
this.eventHandler({ eventName: ProjectInfoTelemetryEvent, data });
10881088

@@ -1092,7 +1092,7 @@ namespace ts.server {
10921092
}
10931093

10941094
const configFilePath = project instanceof server.ConfiguredProject && project.getConfigFilePath();
1095-
const base = ts.getBaseFileName(configFilePath);
1095+
const base = getBaseFileName(configFilePath);
10961096
return base === "tsconfig.json" || base === "jsconfig.json" ? base : "other";
10971097
}
10981098

src/server/lsHost.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
/// <reference path="scriptInfo.ts" />
44

55
namespace ts.server {
6-
export class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost {
7-
private compilationSettings: ts.CompilerOptions;
6+
export class LSHost implements LanguageServiceHost, ModuleResolutionHost {
7+
private compilationSettings: CompilerOptions;
88
private readonly resolvedModuleNames = createMap<Map<ResolvedModuleWithFailedLookupLocations>>();
99
private readonly resolvedTypeReferenceDirectives = createMap<Map<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>>();
1010
private readonly getCanonicalFileName: (fileName: string) => string;
@@ -17,7 +17,7 @@ namespace ts.server {
1717

1818
constructor(private readonly host: ServerHost, private project: Project, private readonly cancellationToken: HostCancellationToken) {
1919
this.cancellationToken = new ThrottledCancellationToken(cancellationToken, project.projectService.throttleWaitMilliseconds);
20-
this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
20+
this.getCanonicalFileName = createGetCanonicalFileName(this.host.useCaseSensitiveFileNames);
2121

2222
if (host.trace) {
2323
this.trace = s => host.trace(s);
@@ -99,7 +99,7 @@ namespace ts.server {
9999
}
100100
}
101101

102-
ts.Debug.assert(resolution !== undefined);
102+
Debug.assert(resolution !== undefined);
103103

104104
resolvedModules.push(getResult(resolution));
105105
}
@@ -177,7 +177,7 @@ namespace ts.server {
177177
return combinePaths(nodeModuleBinDir, getDefaultLibFileName(this.compilationSettings));
178178
}
179179

180-
getScriptSnapshot(filename: string): ts.IScriptSnapshot {
180+
getScriptSnapshot(filename: string): IScriptSnapshot {
181181
const scriptInfo = this.project.getScriptInfoLSHost(filename);
182182
if (scriptInfo) {
183183
return scriptInfo.getSnapshot();
@@ -238,7 +238,7 @@ namespace ts.server {
238238
this.resolvedTypeReferenceDirectives.delete(info.path);
239239
}
240240

241-
setCompilationSettings(opt: ts.CompilerOptions) {
241+
setCompilationSettings(opt: CompilerOptions) {
242242
if (changesAffectModuleResolution(this.compilationSettings, opt)) {
243243
this.resolvedModuleNames.clear();
244244
this.resolvedTypeReferenceDirectives.clear();

src/server/project.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ namespace ts.server {
105105
export abstract class Project {
106106
private rootFiles: ScriptInfo[] = [];
107107
private rootFilesMap: Map<ScriptInfo> = createMap<ScriptInfo>();
108-
private program: ts.Program;
108+
private program: Program;
109109
private externalFiles: SortedReadonlyArray<string>;
110110
private missingFilesMap: Map<FileWatcher> = createMap<FileWatcher>();
111111

@@ -180,14 +180,14 @@ namespace ts.server {
180180
private readonly projectName: string,
181181
readonly projectKind: ProjectKind,
182182
readonly projectService: ProjectService,
183-
private documentRegistry: ts.DocumentRegistry,
183+
private documentRegistry: DocumentRegistry,
184184
hasExplicitListOfFiles: boolean,
185185
languageServiceEnabled: boolean,
186186
private compilerOptions: CompilerOptions,
187187
public compileOnSaveEnabled: boolean) {
188188

189189
if (!this.compilerOptions) {
190-
this.compilerOptions = ts.getDefaultCompilerOptions();
190+
this.compilerOptions = getDefaultCompilerOptions();
191191
this.compilerOptions.allowNonTsExtensions = true;
192192
this.compilerOptions.allowJs = true;
193193
}
@@ -201,7 +201,7 @@ namespace ts.server {
201201
this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken);
202202
this.lsHost.setCompilationSettings(this.compilerOptions);
203203

204-
this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry);
204+
this.languageService = createLanguageService(this.lsHost, this.documentRegistry);
205205

206206
if (!languageServiceEnabled) {
207207
this.disableLanguageService();
@@ -875,7 +875,7 @@ namespace ts.server {
875875
// Used to keep track of what directories are watched for this project
876876
directoriesWatchedForTsconfig: string[] = [];
877877

878-
constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions) {
878+
constructor(projectService: ProjectService, documentRegistry: DocumentRegistry, compilerOptions: CompilerOptions) {
879879
super(InferredProject.newName(),
880880
ProjectKind.Inferred,
881881
projectService,
@@ -948,7 +948,7 @@ namespace ts.server {
948948

949949
constructor(configFileName: NormalizedPath,
950950
projectService: ProjectService,
951-
documentRegistry: ts.DocumentRegistry,
951+
documentRegistry: DocumentRegistry,
952952
hasExplicitListOfFiles: boolean,
953953
compilerOptions: CompilerOptions,
954954
private wildcardDirectories: Map<WatchDirectoryFlags>,
@@ -1152,7 +1152,7 @@ namespace ts.server {
11521152
}
11531153

11541154
getEffectiveTypeRoots() {
1155-
return ts.getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || [];
1155+
return getEffectiveTypeRoots(this.getCompilerOptions(), this.projectService.host) || [];
11561156
}
11571157
}
11581158

@@ -1164,7 +1164,7 @@ namespace ts.server {
11641164
private typeAcquisition: TypeAcquisition;
11651165
constructor(public externalProjectName: string,
11661166
projectService: ProjectService,
1167-
documentRegistry: ts.DocumentRegistry,
1167+
documentRegistry: DocumentRegistry,
11681168
compilerOptions: CompilerOptions,
11691169
languageServiceEnabled: boolean,
11701170
public compileOnSaveEnabled: boolean,

src/server/scriptInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ namespace ts.server {
7272
const lineMap = this.getLineMap();
7373
const start = lineMap[line]; // -1 since line is 1-based
7474
const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
75-
return ts.createTextSpanFromBounds(start, end);
75+
return createTextSpanFromBounds(start, end);
7676
}
7777
const index = this.svc.getSnapshot().index;
7878
const { lineText, absolutePosition } = index.lineNumberToInfo(line + 1);
7979
const len = lineText !== undefined ? lineText.length : index.absolutePositionOfStartOfLine(line + 2) - absolutePosition;
80-
return ts.createTextSpan(absolutePosition, len);
80+
return createTextSpan(absolutePosition, len);
8181
}
8282

8383
/**
@@ -147,7 +147,7 @@ namespace ts.server {
147147
* All projects that include this file
148148
*/
149149
readonly containingProjects: Project[] = [];
150-
private formatCodeSettings: ts.FormatCodeSettings;
150+
private formatCodeSettings: FormatCodeSettings;
151151
readonly path: Path;
152152

153153
private fileWatcher: FileWatcher;

src/server/scriptVersionCache.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ namespace ts.server {
248248
}
249249

250250
getTextChangeRange() {
251-
return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen),
251+
return createTextChangeRange(createTextSpan(this.pos, this.deleteLen),
252252
this.insertedText ? this.insertedText.length : 0);
253253
}
254254
}
@@ -337,21 +337,21 @@ namespace ts.server {
337337
getTextChangesBetweenVersions(oldVersion: number, newVersion: number) {
338338
if (oldVersion < newVersion) {
339339
if (oldVersion >= this.minVersion) {
340-
const textChangeRanges: ts.TextChangeRange[] = [];
340+
const textChangeRanges: TextChangeRange[] = [];
341341
for (let i = oldVersion + 1; i <= newVersion; i++) {
342342
const snap = this.versions[this.versionToIndex(i)];
343343
for (const textChange of snap.changesSincePreviousVersion) {
344344
textChangeRanges.push(textChange.getTextChangeRange());
345345
}
346346
}
347-
return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges);
347+
return collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges);
348348
}
349349
else {
350350
return undefined;
351351
}
352352
}
353353
else {
354-
return ts.unchangedTextChangeRange;
354+
return unchangedTextChangeRange;
355355
}
356356
}
357357

@@ -365,7 +365,7 @@ namespace ts.server {
365365
}
366366
}
367367

368-
export class LineIndexSnapshot implements ts.IScriptSnapshot {
368+
export class LineIndexSnapshot implements IScriptSnapshot {
369369
constructor(readonly version: number, readonly cache: ScriptVersionCache, readonly index: LineIndex, readonly changesSincePreviousVersion: ReadonlyArray<TextChange> = emptyArray) {
370370
}
371371

@@ -377,10 +377,10 @@ namespace ts.server {
377377
return this.index.root.charCount();
378378
}
379379

380-
getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange {
380+
getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange {
381381
if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) {
382382
if (this.version <= oldSnapshot.version) {
383-
return ts.unchangedTextChangeRange;
383+
return unchangedTextChangeRange;
384384
}
385385
else {
386386
return this.cache.getTextChangesBetweenVersions(oldSnapshot.version, this.version);
@@ -539,7 +539,7 @@ namespace ts.server {
539539
}
540540

541541
static linesFromText(text: string) {
542-
const lineMap = ts.computeLineStarts(text);
542+
const lineMap = computeLineStarts(text);
543543

544544
if (lineMap.length === 0) {
545545
return { lines: <string[]>[], lineMap };

src/server/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ namespace ts.server {
138138
terminal: false,
139139
});
140140

141-
class Logger implements ts.server.Logger {
141+
class Logger implements server.Logger {
142142
private fd = -1;
143143
private seq = 0;
144144
private inGroup = false;

0 commit comments

Comments
 (0)