mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Debt: Rename IModeService to ILanguageService
This commit is contained in:
@@ -11,7 +11,7 @@ import { Range } from 'vs/editor/common/core/range';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILanguageService } from 'vs/editor/common/services/languageService';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { ExtHostContext, ExtHostDocumentContentProvidersShape, IExtHostContext, MainContext, MainThreadDocumentContentProvidersShape } from '../common/extHost.protocol';
|
||||
@@ -27,7 +27,7 @@ export class MainThreadDocumentContentProviders implements MainThreadDocumentCon
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@ITextModelService private readonly _textModelResolverService: ITextModelService,
|
||||
@IModeService private readonly _modeService: IModeService,
|
||||
@ILanguageService private readonly _languageService: ILanguageService,
|
||||
@IModelService private readonly _modelService: IModelService,
|
||||
@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService
|
||||
) {
|
||||
@@ -45,7 +45,7 @@ export class MainThreadDocumentContentProviders implements MainThreadDocumentCon
|
||||
return this._proxy.$provideTextDocumentContent(handle, uri).then(value => {
|
||||
if (typeof value === 'string') {
|
||||
const firstLineText = value.substr(0, 1 + value.search(/\r?\n/));
|
||||
const languageSelection = this._modeService.createByFilepathOrFirstLine(uri, firstLineText);
|
||||
const languageSelection = this._languageService.createByFilepathOrFirstLine(uri, firstLineText);
|
||||
return this._modelService.createModel(value, languageSelection, uri);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Range as EditorRange, IRange } from 'vs/editor/common/core/range';
|
||||
import { ExtHostContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, MainContext, IExtHostContext, ILanguageConfigurationDto, IRegExpDto, IIndentationRuleDto, IOnEnterRuleDto, ILocationDto, IWorkspaceSymbolDto, reviveWorkspaceEditDto, IDocumentFilterDto, IDefinitionLinkDto, ISignatureHelpProviderMetadataDto, ILinkDto, ICallHierarchyItemDto, ISuggestDataDto, ICodeActionDto, ISuggestDataDtoField, ISuggestResultDtoField, ICodeActionProviderMetadataDto, ILanguageWordDefinitionDto, IdentifiableInlineCompletions, IdentifiableInlineCompletion, ITypeHierarchyItemDto } from '../common/extHost.protocol';
|
||||
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
|
||||
import { LanguageConfiguration, IndentationRule, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILanguageService } from 'vs/editor/common/services/languageService';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
@@ -28,17 +28,17 @@ import { decodeSemanticTokensDto } from 'vs/editor/common/services/semanticToken
|
||||
export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesShape {
|
||||
|
||||
private readonly _proxy: ExtHostLanguageFeaturesShape;
|
||||
private readonly _modeService: IModeService;
|
||||
private readonly _languageService: ILanguageService;
|
||||
private readonly _registrations = new Map<number, IDisposable>();
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IModeService modeService: IModeService,
|
||||
@ILanguageService languageService: ILanguageService,
|
||||
) {
|
||||
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostLanguageFeatures);
|
||||
this._modeService = modeService;
|
||||
this._languageService = languageService;
|
||||
|
||||
if (this._modeService) {
|
||||
if (this._languageService) {
|
||||
const updateAllWordDefinitions = () => {
|
||||
const langWordPairs = LanguageConfigurationRegistry.getWordDefinitions();
|
||||
let wordDefinitionDtos: ILanguageWordDefinitionDto[] = [];
|
||||
@@ -770,7 +770,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
||||
};
|
||||
}
|
||||
|
||||
const validLanguageId = this._modeService.validateLanguageId(languageId);
|
||||
const validLanguageId = this._languageService.validateLanguageId(languageId);
|
||||
if (validLanguageId) {
|
||||
this._registrations.set(handle, LanguageConfigurationRegistry.register(validLanguageId, configuration, 100));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILanguageService } from 'vs/editor/common/services/languageService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { MainThreadLanguagesShape, MainContext, IExtHostContext, ExtHostContext, ExtHostLanguagesShape } from '../common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
@@ -25,16 +25,16 @@ export class MainThreadLanguages implements MainThreadLanguagesShape {
|
||||
|
||||
constructor(
|
||||
_extHostContext: IExtHostContext,
|
||||
@IModeService private readonly _modeService: IModeService,
|
||||
@ILanguageService private readonly _languageService: ILanguageService,
|
||||
@IModelService private readonly _modelService: IModelService,
|
||||
@ITextModelService private _resolverService: ITextModelService,
|
||||
@ILanguageStatusService private readonly _languageStatusService: ILanguageStatusService,
|
||||
) {
|
||||
this._proxy = _extHostContext.getProxy(ExtHostContext.ExtHostLanguages);
|
||||
|
||||
this._proxy.$acceptLanguageIds(_modeService.getRegisteredModes());
|
||||
this._disposables.add(_modeService.onLanguagesMaybeChanged(e => {
|
||||
this._proxy.$acceptLanguageIds(_modeService.getRegisteredModes());
|
||||
this._proxy.$acceptLanguageIds(_languageService.getRegisteredModes());
|
||||
this._disposables.add(_languageService.onLanguagesMaybeChanged(e => {
|
||||
this._proxy.$acceptLanguageIds(_languageService.getRegisteredModes());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export class MainThreadLanguages implements MainThreadLanguagesShape {
|
||||
|
||||
async $changeLanguage(resource: UriComponents, languageId: string): Promise<void> {
|
||||
|
||||
const validLanguageId = this._modeService.validateLanguageId(languageId);
|
||||
const validLanguageId = this._languageService.validateLanguageId(languageId);
|
||||
if (!validLanguageId || validLanguageId !== languageId) {
|
||||
return Promise.reject(new Error(`Unknown language id: ${languageId}`));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export class MainThreadLanguages implements MainThreadLanguagesShape {
|
||||
const uri = URI.revive(resource);
|
||||
const ref = await this._resolverService.createModelReference(uri);
|
||||
try {
|
||||
this._modelService.setMode(ref.object.textEditorModel, this._modeService.create(languageId));
|
||||
this._modelService.setMode(ref.object.textEditorModel, this._languageService.create(languageId));
|
||||
} finally {
|
||||
ref.dispose();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { combinedDisposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILanguageService } from 'vs/editor/common/services/languageService';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
@@ -46,7 +46,7 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
return flatten(this.preloads.map(p => p.provides));
|
||||
}
|
||||
|
||||
constructor(data: INotebookKernelDto2, private _modeService: IModeService) {
|
||||
constructor(data: INotebookKernelDto2, private _languageService: ILanguageService) {
|
||||
this.id = data.id;
|
||||
this.viewType = data.notebookType;
|
||||
this.extension = data.extensionId;
|
||||
@@ -56,7 +56,7 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
this.description = data.description;
|
||||
this.detail = data.detail;
|
||||
this.kind = data.kind;
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _modeService.getRegisteredModes();
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _languageService.getRegisteredModes();
|
||||
this.implementsExecutionOrder = data.supportsExecutionOrder ?? false;
|
||||
this.localResourceRoot = URI.revive(data.extensionLocation);
|
||||
this.preloads = data.preloads?.map(u => ({ uri: URI.revive(u.uri), provides: u.provides })) ?? [];
|
||||
@@ -83,7 +83,7 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
event.kind = true;
|
||||
}
|
||||
if (data.supportedLanguages !== undefined) {
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._modeService.getRegisteredModes();
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._languageService.getRegisteredModes();
|
||||
event.supportedLanguages = true;
|
||||
}
|
||||
if (data.supportsExecutionOrder !== undefined) {
|
||||
@@ -110,7 +110,7 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IModeService private readonly _modeService: IModeService,
|
||||
@ILanguageService private readonly _languageService: ILanguageService,
|
||||
@INotebookKernelService private readonly _notebookKernelService: INotebookKernelService,
|
||||
@INotebookExecutionService private readonly _notebookExecutionService: INotebookExecutionService,
|
||||
// @INotebookService private readonly _notebookService: INotebookService,
|
||||
@@ -197,7 +197,7 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
async cancelNotebookCellExecution(uri: URI, handles: number[]): Promise<void> {
|
||||
await that._proxy.$cancelCells(handle, uri, handles);
|
||||
}
|
||||
}(data, this._modeService);
|
||||
}(data, this._languageService);
|
||||
|
||||
const listener = this._notebookKernelService.onDidChangeSelectedNotebooks(e => {
|
||||
if (e.oldKernel === kernel.id) {
|
||||
|
||||
Reference in New Issue
Block a user