@jupyter-lsp/jupyterlab-lsp
Version:
Language Server Protocol integration for JupyterLab
119 lines (118 loc) • 4.63 kB
TypeScript
import { ILanguageServerManager, LanguageServerManager } from '@jupyterlab/lsp';
import { ISettingRegistry, ISchemaValidator } from '@jupyterlab/settingregistry';
import { TranslationBundle } from '@jupyterlab/translation';
import { ISignal } from '@lumino/signaling';
import { FieldProps } from '@rjsf/utils';
import { LanguageServers } from './_plugin';
import { ILSPLogConsole } from './tokens';
type ValueOf<T> = T[keyof T];
type ServerSchemaWrapper = ValueOf<Required<LanguageServers>['language_servers']>;
/**
* Settings keyed by language server name with values including
* multiple properties, such as priority or workspace configuration
*/
type LanguageServerSettings = Record<string, ServerSchemaWrapper>;
export declare class SettingsUIManager {
protected options: {
settingRegistry: ISettingRegistry;
languageServerManager: ILanguageServerManager;
console: ILSPLogConsole;
trans: TranslationBundle;
schemaValidated: ISignal<SettingsSchemaManager, ISchemaValidator.IError[]>;
};
constructor(options: {
settingRegistry: ISettingRegistry;
languageServerManager: ILanguageServerManager;
console: ILSPLogConsole;
trans: TranslationBundle;
schemaValidated: ISignal<SettingsSchemaManager, ISchemaValidator.IError[]>;
});
renderForm(props: FieldProps): import("react").JSX.Element;
private _validationErrors;
}
/**
* Harmonize settings from schema, defaults from specification, and values set by user.
*/
export declare class SettingsSchemaManager {
protected options: {
settingRegistry: ISettingRegistry;
languageServerManager: ILanguageServerManager;
console: ILSPLogConsole;
trans: TranslationBundle;
/**
* Promise resolved when JupyterLab splash screen disappears.
*/
restored: Promise<void>;
};
constructor(options: {
settingRegistry: ISettingRegistry;
languageServerManager: ILanguageServerManager;
console: ILSPLogConsole;
trans: TranslationBundle;
/**
* Promise resolved when JupyterLab splash screen disappears.
*/
restored: Promise<void>;
});
get schemaValidated(): ISignal<SettingsSchemaManager, ISchemaValidator.IError[]>;
protected get console(): ILSPLogConsole;
/**
* Add schema for individual language servers into JSON schema.
* This method has to be called before any other action
* is performed on settingRegistry with regard to pluginId.
*/
setupSchemaTransform(pluginId: string): Promise<void>;
/**
* Populate the plugin's schema defaults, transform descriptions.
*/
private _populate;
/**
* Transform the plugin schema defaults, properties and descriptions
*/
static transformSchemas(options: {
schema: ISettingRegistry.ISchema;
specs: LanguageServerManager['specs'];
sessions: ILanguageServerManager['sessions'];
console?: ILSPLogConsole;
trans?: TranslationBundle;
}): {
properties: Record<string, any>;
defaults: Record<string, any>;
};
/**
* Expands dotted values into nested properties when the server config schema
* indicates that this is needed. The schema is passed within the specs.
*
* This is needed because some settings, specifically pright's
* `python.analysis.diagnosticSeverityOverrides` are defined as nested.
*/
static expandDottedAsNeeded(options: {
dottedSettings: LanguageServerSettings;
specs: LanguageServerManager['specs'];
}): LanguageServerSettings;
/**
* Normalize settings by dotted and nested specs, and merging with defaults.
*/
normalizeSettings(composite: Required<LanguageServers>): Promise<Required<LanguageServers>>;
private _wasPreviouslyValidated;
/**
* Validate user settings from plugin against provided schema,
* asynchronously to avoid blocking the main thread.
* Stores validation result in `this._validationErrors`.
*/
private _validateSchemaLater;
private _warnConflicts;
private _collapseServerSettingsDotted;
static mergeByServer(defaults: LanguageServerSettings, userSettings: LanguageServerSettings): LanguageServerSettings;
private _defaults;
private _defaultsPopulated;
private _validationErrors;
private _schemaValidated;
private _validationAttempt;
private _lastValidation;
private _lastUserServerSettings;
private _lastUserServerSettingsDoted;
private _canonical;
private _original;
}
export {};