Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/harness/evaluatorImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CommonJsLoader extends Loader<CommonJSModule> {
return this.resolveIndex(dir);
}

protected resolve(id: string, base: string) {
protected override resolve(id: string, base: string) {
const file = vpath.resolve(base, id);
const resolved = this.resolveAsFile(file) || this.resolveAsDirectory(file);
if (!resolved) throw new Error(`Module '${id}' could not be found.`);
Expand Down
28 changes: 14 additions & 14 deletions src/harness/harnessLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,23 +295,23 @@ class NativeLanguageServiceHost extends LanguageServiceAdapterHost implements ts
return script ? script.version.toString() : undefined!; // TODO: GH#18217
}

directoryExists(dirName: string): boolean {
override directoryExists(dirName: string): boolean {
return this.sys.directoryExists(dirName);
}

fileExists(fileName: string): boolean {
override fileExists(fileName: string): boolean {
return this.sys.fileExists(fileName);
}

readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[] {
return this.sys.readDirectory(path, extensions, exclude, include, depth);
}

readFile(path: string): string | undefined {
override readFile(path: string): string | undefined {
return this.sys.readFile(path);
}

realpath(path: string): string {
override realpath(path: string): string {
return this.sys.realpath(path);
}

Expand Down Expand Up @@ -389,11 +389,11 @@ class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.L
}
}

getFilenames(): string[] { return this.nativeHost.getFilenames(); }
getScriptInfo(fileName: string): ScriptInfo | undefined { return this.nativeHost.getScriptInfo(fileName); }
addScript(fileName: string, content: string, isRootFile: boolean): void { this.nativeHost.addScript(fileName, content, isRootFile); }
editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); }
positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); }
override getFilenames(): string[] { return this.nativeHost.getFilenames(); }
override getScriptInfo(fileName: string): ScriptInfo | undefined { return this.nativeHost.getScriptInfo(fileName); }
override addScript(fileName: string, content: string, isRootFile: boolean): void { this.nativeHost.addScript(fileName, content, isRootFile); }
override editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); }
override positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); }

getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); }
getCancellationToken(): ts.HostCancellationToken { return this.nativeHost.getCancellationToken(); }
Expand All @@ -412,15 +412,15 @@ class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.L
readDirectory = ts.notImplemented;
readDirectoryNames = ts.notImplemented;
readFileNames = ts.notImplemented;
fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
readFile(fileName: string) {
override fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; }
override readFile(fileName: string) {
const snapshot = this.nativeHost.getScriptSnapshot(fileName);
return snapshot && ts.getSnapshotText(snapshot);
}
log(s: string): void { this.nativeHost.log(s); }
trace(s: string): void { this.nativeHost.trace(s); }
error(s: string): void { this.nativeHost.error(s); }
directoryExists(): boolean {
override directoryExists(): boolean {
// for tests pessimistically assume that directory always exists
return true;
}
Expand Down Expand Up @@ -746,12 +746,12 @@ class SessionClientHost extends NativeLanguageServiceHost implements ts.server.S
this.client = client;
}

openFile(fileName: string, content?: string, scriptKindName?: "TS" | "JS" | "TSX" | "JSX"): void {
override openFile(fileName: string, content?: string, scriptKindName?: "TS" | "JS" | "TSX" | "JSX"): void {
super.openFile(fileName, content, scriptKindName);
this.client.openFile(fileName, content, scriptKindName);
}

editScript(fileName: string, start: number, end: number, newText: string) {
override editScript(fileName: string, start: number, end: number, newText: string) {
const changeArgs = this.client.createChangeFileRequestArgs(fileName, start, end, newText);
super.editScript(fileName, start, end, newText);
this.client.changeFile(fileName, changeArgs);
Expand Down
74 changes: 37 additions & 37 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,7 @@ export class InferredProject extends Project {
}
}

setCompilerOptions(options?: CompilerOptions) {
override setCompilerOptions(options?: CompilerOptions) {
// Avoid manipulating the given options directly
if (!options && !this.getCompilationSettings()) {
return;
Expand Down Expand Up @@ -2180,7 +2180,7 @@ export class InferredProject extends Project {
this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides);
}

addRoot(info: ScriptInfo) {
override addRoot(info: ScriptInfo) {
Debug.assert(info.isScriptOpen());
this.projectService.startWatchingConfigFilesForInferredProjectRoot(info);
if (!this._isJsInferredProject && info.isJavaScript()) {
Expand All @@ -2189,7 +2189,7 @@ export class InferredProject extends Project {
super.addRoot(info);
}

removeRoot(info: ScriptInfo) {
override removeRoot(info: ScriptInfo) {
this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
super.removeRoot(info);
if (this._isJsInferredProject && info.isJavaScript()) {
Expand All @@ -2200,7 +2200,7 @@ export class InferredProject extends Project {
}

/** @internal */
isOrphan() {
override isOrphan() {
return !this.hasRoots();
}

Expand All @@ -2212,12 +2212,12 @@ export class InferredProject extends Project {
this.getRootScriptInfos().length === 1;
}

close() {
override close() {
forEach(this.getRootScriptInfos(), info => this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info));
super.close();
}

getTypeAcquisition(): TypeAcquisition {
override getTypeAcquisition(): TypeAcquisition {
return this.typeAcquisition || {
enable: allRootFilesAreJsOrDts(this),
include: ts.emptyArray,
Expand All @@ -2241,12 +2241,12 @@ class AuxiliaryProject extends Project {
/*currentDirectory*/ undefined);
}

isOrphan(): boolean {
override isOrphan(): boolean {
return true;
}

/** @internal */
scheduleInvalidateResolutionsOfFailedLookupLocations(): void {
override scheduleInvalidateResolutionsOfFailedLookupLocations(): void {
// Invalidation will happen on-demand as part of updateGraph
return;
}
Expand Down Expand Up @@ -2436,11 +2436,11 @@ export class AutoImportProviderProject extends Project {
return !some(this.rootFileNames);
}

isOrphan() {
override isOrphan() {
return true;
}

updateGraph() {
override updateGraph() {
let rootFileNames = this.rootFileNames;
if (!rootFileNames) {
rootFileNames = AutoImportProviderProject.getRootFileNames(
Expand All @@ -2461,62 +2461,62 @@ export class AutoImportProviderProject extends Project {
}

/** @internal */
scheduleInvalidateResolutionsOfFailedLookupLocations(): void {
override scheduleInvalidateResolutionsOfFailedLookupLocations(): void {
// Invalidation will happen on-demand as part of updateGraph
return;
}

hasRoots() {
override hasRoots() {
return !!this.rootFileNames?.length;
}

markAsDirty() {
override markAsDirty() {
this.rootFileNames = undefined;
super.markAsDirty();
}

getScriptFileNames() {
override getScriptFileNames() {
return this.rootFileNames || ts.emptyArray;
}

getLanguageService(): never {
override getLanguageService(): never {
throw new Error("AutoImportProviderProject language service should never be used. To get the program, use `project.getCurrentProgram()`.");
}

/** @internal */
onAutoImportProviderSettingsChanged(): never {
override onAutoImportProviderSettingsChanged(): never {
throw new Error("AutoImportProviderProject is an auto import provider; use `markAsDirty()` instead.");
}

/** @internal */
onPackageJsonChange(): never {
override onPackageJsonChange(): never {
throw new Error("package.json changes should be notified on an AutoImportProvider's host project");
}

getModuleResolutionHostForAutoImportProvider(): never {
override getModuleResolutionHostForAutoImportProvider(): never {
throw new Error("AutoImportProviderProject cannot provide its own host; use `hostProject.getModuleResolutionHostForAutomImportProvider()` instead.");
}

getProjectReferences() {
override getProjectReferences() {
return this.hostProject.getProjectReferences();
}

/** @internal */
includePackageJsonAutoImports() {
override includePackageJsonAutoImports() {
return PackageJsonAutoImportPreference.Off;
}

getTypeAcquisition(): TypeAcquisition {
override getTypeAcquisition(): TypeAcquisition {
return { enable: false };
}

/** @internal */
getSymlinkCache() {
override getSymlinkCache() {
return this.hostProject.getSymlinkCache();
}

/** @internal */
getModuleResolutionCache() {
override getModuleResolutionCache() {
return this.hostProject.getCurrentProgram()?.getModuleResolutionCache();
}
}
Expand Down Expand Up @@ -2554,7 +2554,7 @@ export class ConfiguredProject extends Project {
projectOptions?: ProjectOptions | true;

/** @internal */
isInitialLoadPending: () => boolean = returnTrue;
override isInitialLoadPending: () => boolean = returnTrue;

/** @internal */
sendLoadingProjectFinish = false;
Expand Down Expand Up @@ -2593,12 +2593,12 @@ export class ConfiguredProject extends Project {
}

/** @internal */
useSourceOfProjectReferenceRedirect() {
override useSourceOfProjectReferenceRedirect() {
return this.languageServiceEnabled;
}

/** @internal */
getParsedCommandLine(fileName: string) {
override getParsedCommandLine(fileName: string) {
const configFileName = asNormalizedPath(normalizePath(fileName));
const canonicalConfigFilePath = asNormalizedPath(this.projectService.toCanonicalFileName(configFileName));
// Ensure the config file existience info is cached
Expand Down Expand Up @@ -2630,7 +2630,7 @@ export class ConfiguredProject extends Project {
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
updateGraph(): boolean {
override updateGraph(): boolean {
const isInitialLoad = this.isInitialLoadPending();
this.isInitialLoadPending = returnFalse;
const reloadLevel = this.pendingReload;
Expand Down Expand Up @@ -2658,15 +2658,15 @@ export class ConfiguredProject extends Project {
}

/** @internal */
getCachedDirectoryStructureHost() {
override getCachedDirectoryStructureHost() {
return this.directoryStructureHost as CachedDirectoryStructureHost;
}

getConfigFilePath() {
return asNormalizedPath(this.getProjectName());
}

getProjectReferences(): readonly ProjectReference[] | undefined {
override getProjectReferences(): readonly ProjectReference[] | undefined {
return this.projectReferences;
}

Expand All @@ -2682,7 +2682,7 @@ export class ConfiguredProject extends Project {
}

/** @internal */
getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined {
override getResolvedProjectReferenceToRedirect(fileName: string): ResolvedProjectReference | undefined {
const program = this.getCurrentProgram();
return program && program.getResolvedProjectReferenceToRedirect(fileName);
}
Expand Down Expand Up @@ -2724,22 +2724,22 @@ export class ConfiguredProject extends Project {
/**
* Get the errors that dont have any file name associated
*/
getGlobalProjectErrors(): readonly Diagnostic[] {
override getGlobalProjectErrors(): readonly Diagnostic[] {
return filter(this.projectErrors, diagnostic => !diagnostic.file) || emptyArray;
}

/**
* Get all the project errors
*/
getAllProjectErrors(): readonly Diagnostic[] {
override getAllProjectErrors(): readonly Diagnostic[] {
return this.projectErrors || emptyArray;
}

setProjectErrors(projectErrors: Diagnostic[]) {
override setProjectErrors(projectErrors: Diagnostic[]) {
this.projectErrors = projectErrors;
}

close() {
override close() {
this.projectService.configFileExistenceInfoCache.forEach((_configFileExistenceInfo, canonicalConfigFilePath) =>
this.releaseParsedConfig(canonicalConfigFilePath));
this.projectErrors = undefined;
Expand Down Expand Up @@ -2848,7 +2848,7 @@ export class ExternalProject extends Project {
documentRegistry: DocumentRegistry,
compilerOptions: CompilerOptions,
lastFileExceededProgramSize: string | undefined,
public compileOnSaveEnabled: boolean,
public override compileOnSaveEnabled: boolean,
projectFilePath?: string,
pluginConfigOverrides?: Map<string, any>,
watchOptions?: WatchOptions) {
Expand All @@ -2866,13 +2866,13 @@ export class ExternalProject extends Project {
this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides);
}

updateGraph() {
override updateGraph() {
const result = super.updateGraph();
this.projectService.sendProjectTelemetry(this);
return result;
}

getExcludedFiles() {
override getExcludedFiles() {
return this.excludedFiles;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ class SymbolObject implements Symbol {
}

class TokenObject<TKind extends SyntaxKind> extends TokenOrIdentifierObject implements Token<TKind> {
public kind: TKind;
public override kind: TKind;

constructor(kind: TKind, pos: number, end: number) {
super(pos, end);
Expand All @@ -731,7 +731,7 @@ class TokenObject<TKind extends SyntaxKind> extends TokenOrIdentifierObject impl
}

class IdentifierObject extends TokenOrIdentifierObject implements Identifier {
public kind: SyntaxKind.Identifier = SyntaxKind.Identifier;
public override kind: SyntaxKind.Identifier = SyntaxKind.Identifier;
public escapedText!: __String;
declare _primaryExpressionBrand: any;
declare _memberExpressionBrand: any;
Expand All @@ -753,7 +753,7 @@ class IdentifierObject extends TokenOrIdentifierObject implements Identifier {
}
IdentifierObject.prototype.kind = SyntaxKind.Identifier;
class PrivateIdentifierObject extends TokenOrIdentifierObject implements PrivateIdentifier {
public kind: SyntaxKind.PrivateIdentifier = SyntaxKind.PrivateIdentifier;
public override kind: SyntaxKind.PrivateIdentifier = SyntaxKind.PrivateIdentifier;
public escapedText!: __String;
declare _primaryExpressionBrand: any;
declare _memberExpressionBrand: any;
Expand Down Expand Up @@ -992,7 +992,7 @@ function findBaseOfDeclaration<T>(checker: TypeChecker, declaration: Declaration
}

class SourceFileObject extends NodeObject implements SourceFile {
public kind: SyntaxKind.SourceFile = SyntaxKind.SourceFile;
public override kind: SyntaxKind.SourceFile = SyntaxKind.SourceFile;
declare _declarationBrand: any;
declare _localsContainerBrand: any;
public fileName!: string;
Expand Down
Loading