Skip to content

Commit d3e4419

Browse files
committed
fix: Review fixes: rename enableProxy, extend PluginSettings, formatting
1 parent d807ec3 commit d3e4419

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/plugins.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ export class PluginLoader {
168168
private resolveJavaScriptModule(moduleName: string, initialDir: string, host: ts.ModuleResolutionHost): string {
169169
// TODO: this should set jsOnly=true to the internal resolver, but this parameter is not exposed on a public api.
170170
const result =
171-
ts.nodeModuleNameResolver(moduleName, /* containingFile */ initialDir.replace('\\', '/') + '/package.json', { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, this.resolutionHost, undefined);
171+
ts.nodeModuleNameResolver(
172+
moduleName,
173+
initialDir.replace('\\', '/') + '/package.json', /* containingFile */
174+
{ moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true },
175+
this.resolutionHost,
176+
undefined
177+
);
172178
if (!result.resolvedModule) {
173179
// this.logger.error(result.failedLookupLocations);
174180
throw new Error(`Could not resolve JS module ${moduleName} starting at ${initialDir}.`);

src/project-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ export class ProjectConfiguration {
923923
);
924924
this.service = ts.createLanguageService(this.host, this.documentRegistry);
925925
const pluginLoader = new PluginLoader(this.rootFilePath, this.fs, this.pluginSettings, this.logger);
926-
pluginLoader.loadPlugins(options, this.enableProxy.bind(this) /* (factory, config) => this.enableProxy(factory, config)) */);
926+
pluginLoader.loadPlugins(options, (factory, config) => this.wrapService(factory, config));
927927
this.initialized = true;
928928
}
929929

@@ -932,7 +932,7 @@ export class ProjectConfiguration {
932932
* @param pluginModuleFactory function to create the module
933933
* @param configEntry extra settings from tsconfig to pass to the plugin module
934934
*/
935-
private enableProxy(pluginModuleFactory: PluginModuleFactory, configEntry: ts.PluginImport) {
935+
private wrapService(pluginModuleFactory: PluginModuleFactory, configEntry: ts.PluginImport) {
936936
try {
937937
if (typeof pluginModuleFactory !== 'function') {
938938
this.logger.info(`Skipped loading plugin ${configEntry.name} because it didn't expose a proper factory function`);

src/typescript-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export type TypeScriptServiceFactory = (client: LanguageClient, options?: TypeSc
8787
/**
8888
* Settings synced through `didChangeConfiguration`
8989
*/
90-
export type Settings = {
90+
export interface Settings extends PluginSettings {
9191
format: ts.FormatCodeSettings
92-
} & PluginSettings;
92+
}
9393

9494
/**
9595
* Handles incoming requests and return responses. There is a one-to-one-to-one

0 commit comments

Comments
 (0)