Debt: Rename IModeService to ILanguageService

This commit is contained in:
Alex Dima 2021-12-08 14:36:00 +01:00
parent 3bea4b8f85
commit 91b97cec91
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
139 changed files with 673 additions and 673 deletions

View file

@ -88,7 +88,7 @@ declare namespace monaco.languages {
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;model.=>editor.;IMarkerData=>editor.IMarkerData):
#includeAll(vs/editor/common/modes/languageConfiguration):
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData;model.=>editor.):
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
#include(vs/editor/common/services/languageService): ILanguageExtensionPoint
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
}

View file

@ -6,7 +6,7 @@
import { IMarkdownString } from 'vs/base/common/htmlContent';
import { renderMarkdown, MarkdownRenderOptions, MarkedOptions } from 'vs/base/browser/markdownRenderer';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { onUnexpectedError } from 'vs/base/common/errors';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
@ -44,7 +44,7 @@ export class MarkdownRenderer {
constructor(
private readonly _options: IMarkdownRendererOptions,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IOpenerService private readonly _openerService: IOpenerService,
) { }
@ -75,19 +75,19 @@ export class MarkdownRenderer {
// it is possible no alias is given in which case we fall back to the current editor lang
let languageId: string | undefined | null;
if (languageAlias) {
languageId = this._modeService.getModeIdForLanguageName(languageAlias);
languageId = this._languageService.getModeIdForLanguageName(languageAlias);
} else if (this._options.editor) {
languageId = this._options.editor.getModel()?.getLanguageId();
}
if (!languageId) {
languageId = 'plaintext';
}
this._modeService.triggerMode(languageId);
this._languageService.triggerMode(languageId);
const tokenization = await TokenizationRegistry.getPromise(languageId) ?? undefined;
const element = document.createElement('span');
element.innerHTML = (MarkdownRenderer._ttpTokenizer?.createHTML(value, this._modeService.languageIdCodec, tokenization) ?? tokenizeToString(value, this._modeService.languageIdCodec, tokenization)) as string;
element.innerHTML = (MarkdownRenderer._ttpTokenizer?.createHTML(value, this._languageService.languageIdCodec, tokenization) ?? tokenizeToString(value, this._languageService.languageIdCodec, tokenization)) as string;
// use "good" font
if (this._options.editor) {

View file

@ -33,7 +33,7 @@ import { Constants } from 'vs/base/common/uint';
import { Codicon } from 'vs/base/common/codicons';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { ILanguageIdCodec } from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
const DIFF_LINES_PADDING = 3;
@ -96,7 +96,7 @@ export class DiffReview extends Disposable {
constructor(
diffEditor: DiffEditorWidget,
@IModeService private readonly _modeService: IModeService
@ILanguageService private readonly _languageService: ILanguageService
) {
super();
this._diffEditor = diffEditor;
@ -629,7 +629,7 @@ export class DiffReview extends Disposable {
let modLine = minModifiedLine;
for (let i = 0, len = diffs.length; i < len; i++) {
const diffEntry = diffs[i];
DiffReview._renderSection(container, diffEntry, modLine, lineHeight, this._width, originalOptions, originalModel, originalModelOpts, modifiedOptions, modifiedModel, modifiedModelOpts, this._modeService.languageIdCodec);
DiffReview._renderSection(container, diffEntry, modLine, lineHeight, this._width, originalOptions, originalModel, originalModelOpts, modifiedOptions, modifiedModel, modifiedModelOpts, this._languageService.languageIdCodec);
if (diffEntry.modifiedLineStart !== 0) {
modLine = diffEntry.modifiedLineEnd;
}

View file

@ -40,7 +40,7 @@ import { getWordAtText } from 'vs/editor/common/model/wordHelper';
import { FormattingOptions, StandardTokenType } from 'vs/editor/common/modes';
import { ILanguageConfigurationService, ResolvedLanguageConfiguration } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_MODE_ID } from 'vs/editor/common/modes/nullMode';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { EditorTheme } from 'vs/editor/common/view/viewContext';
import { ThemeColor } from 'vs/platform/theme/common/themeService';
import { IUndoRedoService, ResourceEditStackSnapshot } from 'vs/platform/undoRedo/common/undoRedo';
@ -328,7 +328,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
languageId: string | null,
associatedResource: URI | null = null,
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,
) {
super();
@ -398,9 +398,9 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
this._isRedoing = false;
this._trimAutoWhitespaceLines = null;
this._tokens = new TokensStore(this._modeService.languageIdCodec);
this._tokens2 = new TokensStore2(this._modeService.languageIdCodec);
this._tokenization = new TextModelTokenization(this, this._modeService.languageIdCodec);
this._tokens = new TokensStore(this._languageService.languageIdCodec);
this._tokens2 = new TokensStore2(this._languageService.languageIdCodec);
this._tokenization = new TextModelTokenization(this, this._languageService.languageIdCodec);
this._bracketPairColorizer = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));
this._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));

View file

@ -20,7 +20,7 @@ import { RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBracke
import { EditorAutoIndentStrategy } from 'vs/editor/common/config/editorOptions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
/**
@ -72,7 +72,7 @@ export class LanguageConfigurationService extends Disposable implements ILanguag
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
@IModeService private readonly modeService: IModeService
@ILanguageService private readonly languageService: ILanguageService
) {
super();
@ -86,7 +86,7 @@ export class LanguageConfigurationService extends Disposable implements ILanguag
.filter(([overrideLangName, keys]) =>
keys.some((k) => languageConfigKeys.has(k))
)
.map(([overrideLangName]) => this.modeService.validateLanguageId(overrideLangName));
.map(([overrideLangName]) => this.languageService.validateLanguageId(overrideLangName));
if (globalConfigChanged) {
this.configurations.clear();
@ -110,7 +110,7 @@ export class LanguageConfigurationService extends Disposable implements ILanguag
public getLanguageConfiguration(languageId: string): ResolvedLanguageConfiguration {
let result = this.configurations.get(languageId);
if (!result) {
result = computeConfig(languageId, this.configurationService, this.modeService);
result = computeConfig(languageId, this.configurationService, this.languageService);
this.configurations.set(languageId, result);
}
return result;
@ -120,12 +120,12 @@ export class LanguageConfigurationService extends Disposable implements ILanguag
function computeConfig(
languageId: string,
configurationService: IConfigurationService,
modeService: IModeService,
languageService: ILanguageService,
): ResolvedLanguageConfiguration {
let languageConfig = LanguageConfigurationRegistry.getLanguageConfiguration(languageId);
if (!languageConfig) {
const validLanguageId = modeService.validateLanguageId(languageId);
const validLanguageId = languageService.validateLanguageId(languageId);
if (!validLanguageId) {
throw new Error('Unexpected languageId');
}

View file

@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import { Emitter, Event } from 'vs/base/common/event';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService';
import { ILanguageExtensionPoint } from 'vs/editor/common/services/languageService';
import { Registry } from 'vs/platform/registry/common/platform';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Mimes } from 'vs/base/common/mime';

View file

@ -7,11 +7,11 @@ import { Schemas } from 'vs/base/common/network';
import { DataUri, basenameOrAuthority } from 'vs/base/common/resources';
import { URI as uri } from 'vs/base/common/uri';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
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 { FileKind } from 'vs/platform/files/common/files';
export function getIconClasses(modelService: IModelService, modeService: IModeService, resource: uri | undefined, fileKind?: FileKind): string[] {
export function getIconClasses(modelService: IModelService, languageService: ILanguageService, resource: uri | undefined, fileKind?: FileKind): string[] {
// we always set these base classes even if we do not have a path
const classes = fileKind === FileKind.ROOT_FOLDER ? ['rootfolder-icon'] : fileKind === FileKind.FOLDER ? ['folder-icon'] : ['file-icon'];
@ -50,7 +50,7 @@ export function getIconClasses(modelService: IModelService, modeService: IModeSe
}
// Detected Mode
const detectedModeId = detectModeId(modelService, modeService, resource);
const detectedModeId = detectModeId(modelService, languageService, resource);
if (detectedModeId) {
classes.push(`${cssEscape(detectedModeId)}-lang-file-icon`);
}
@ -64,7 +64,7 @@ export function getIconClassesForModeId(modeId: string): string[] {
return ['file-icon', `${cssEscape(modeId)}-lang-file-icon`];
}
function detectModeId(modelService: IModelService, modeService: IModeService, resource: uri): string | null {
function detectModeId(modelService: IModelService, languageService: ILanguageService, resource: uri): string | null {
if (!resource) {
return null; // we need a resource at least
}
@ -77,7 +77,7 @@ function detectModeId(modelService: IModelService, modeService: IModeService, re
const mime = metadata.get(DataUri.META_DATA_MIME);
if (mime) {
modeId = modeService.getModeId(mime);
modeId = languageService.getModeId(mime);
}
}
@ -95,7 +95,7 @@ function detectModeId(modelService: IModelService, modeService: IModeService, re
}
// otherwise fallback to path based detection
return modeService.getModeIdByFilepathOrFirstLine(resource);
return languageService.getModeIdByFilepathOrFirstLine(resource);
}
export function cssEscape(str: string): string {

View file

@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri';
import { ILanguageIdCodec } from 'vs/editor/common/modes';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const IModeService = createDecorator<IModeService>('modeService');
export const ILanguageService = createDecorator<ILanguageService>('languageService');
export interface ILanguageExtensionPoint {
id: string;
@ -26,7 +26,7 @@ export interface ILanguageSelection {
readonly onDidChange: Event<string>;
}
export interface IModeService {
export interface ILanguageService {
readonly _serviceBrand: undefined;
readonly languageIdCodec: ILanguageIdCodec;

View file

@ -12,7 +12,7 @@ import { URI } from 'vs/base/common/uri';
import { ILanguageIdCodec, LanguageId } from 'vs/editor/common/modes';
import { ModesRegistry, PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { NULL_MODE_ID } from 'vs/editor/common/modes/nullMode';
import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService';
import { ILanguageExtensionPoint } from 'vs/editor/common/services/languageService';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';

View file

@ -8,7 +8,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { NULL_MODE_ID } from 'vs/editor/common/modes/nullMode';
import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry';
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/services/languageService';
import { firstOrDefault } from 'vs/base/common/arrays';
import { ILanguageIdCodec } from 'vs/editor/common/modes';
@ -47,7 +47,7 @@ class LanguageSelection implements ILanguageSelection {
}
}
export class ModeServiceImpl extends Disposable implements IModeService {
export class ModeServiceImpl extends Disposable implements ILanguageService {
public _serviceBrand: undefined;
static instanceCount = 0;

View file

@ -6,7 +6,7 @@
import { Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { ITextBufferFactory, ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model';
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
import { ILanguageSelection } from 'vs/editor/common/services/languageService';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { DocumentSemanticTokensProvider, DocumentRangeSemanticTokensProvider } from 'vs/editor/common/modes';
import { SemanticTokensProviderStyling } from 'vs/editor/common/services/semanticTokensProviderStyling';

View file

@ -16,7 +16,7 @@ import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
import { IModelLanguageChangedEvent, IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
import { DocumentSemanticTokensProviderRegistry, DocumentSemanticTokensProvider, SemanticTokens, SemanticTokensEdits } from 'vs/editor/common/modes';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/services/languageService';
import { IModelService, DocumentTokensProvider } from 'vs/editor/common/services/modelService';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -162,7 +162,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
@IThemeService private readonly _themeService: IThemeService,
@ILogService private readonly _logService: ILogService,
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService
) {
super();
@ -170,7 +170,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
this._models = {};
this._disposedModels = new Map<string, DisposedModelInfo>();
this._disposedModelsHeapSize = 0;
this._semanticStyling = this._register(new SemanticStyling(this._themeService, this._modeService, this._logService));
this._semanticStyling = this._register(new SemanticStyling(this._themeService, this._languageService, this._logService));
this._register(this._configurationService.onDidChangeConfiguration(() => this._updateModelOptions()));
this._updateModelOptions();
@ -374,7 +374,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
languageId,
resource,
this._undoRedoService,
this._modeService,
this._languageService,
this._languageConfigurationService,
);
if (resource && this._disposedModels.has(MODEL_ID(resource))) {
@ -704,7 +704,7 @@ class SemanticStyling extends Disposable {
constructor(
private readonly _themeService: IThemeService,
private readonly _modeService: IModeService,
private readonly _languageService: ILanguageService,
private readonly _logService: ILogService
) {
super();
@ -716,7 +716,7 @@ class SemanticStyling extends Disposable {
public get(provider: DocumentTokensProvider): SemanticTokensProviderStyling {
if (!this._caches.has(provider)) {
this._caches.set(provider, new SemanticTokensProviderStyling(provider.getLegend(), this._themeService, this._modeService, this._logService));
this._caches.set(provider, new SemanticTokensProviderStyling(provider.getLegend(), this._themeService, this._languageService, this._logService));
}
return this._caches.get(provider)!;
}

View file

@ -7,7 +7,7 @@ import { SemanticTokensLegend, TokenMetadata, FontStyle, MetadataConsts, Semanti
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
import { MultilineTokens2, SparseEncodedTokens } from 'vs/editor/common/model/tokensStore';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
export const enum SemanticTokensProviderStylingConstants {
NO_STYLING = 0b01111111111111111111111111111111
@ -21,7 +21,7 @@ export class SemanticTokensProviderStyling {
constructor(
private readonly _legend: SemanticTokensLegend,
@IThemeService private readonly _themeService: IThemeService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILogService private readonly _logService: ILogService
) {
this._hashTable = new HashTable();
@ -29,7 +29,7 @@ export class SemanticTokensProviderStyling {
}
public getMetadata(tokenTypeIndex: number, tokenModifierSet: number, languageId: string): number {
const encodedLanguageId = this._modeService.languageIdCodec.encodeLanguageId(languageId);
const encodedLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
const entry = this._hashTable.get(tokenTypeIndex, tokenModifierSet, encodedLanguageId);
let metadata: number;
if (entry) {

View file

@ -7,7 +7,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IPosition, Position } from 'vs/editor/common/core/position';
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 { ITextResourceConfigurationService, ITextResourceConfigurationChangeEvent } from 'vs/editor/common/services/textResourceConfigurationService';
import { IConfigurationService, ConfigurationTarget, IConfigurationValue, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
@ -22,7 +22,7 @@ export class TextResourceConfigurationService extends Disposable implements ITex
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
) {
super();
this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))));
@ -111,7 +111,7 @@ export class TextResourceConfigurationService extends Disposable implements ITex
if (model) {
return position ? model.getLanguageIdAtPosition(position.lineNumber, position.column) : model.getLanguageId();
}
return this.modeService.getModeIdByFilepathOrFirstLine(resource);
return this.languageService.getModeIdByFilepathOrFirstLine(resource);
}
private toResourceConfigurationChangeEvent(configurationChangeEvent: IConfigurationChangeEvent): ITextResourceConfigurationChangeEvent {

View file

@ -12,7 +12,7 @@ import { ColorId, IState, MetadataConsts, TokenizationRegistry } from 'vs/editor
import { CommentRule } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ILinePreflightData, IPreflightData, ISimpleModel, LineCommentCommand, Type } from 'vs/editor/contrib/comment/lineCommentCommand';
import { testCommand } from 'vs/editor/test/browser/testCommand';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@ -1082,7 +1082,7 @@ suite('Editor Contrib - Line Comment in mixed modes', () => {
class OuterMode extends MockMode {
constructor(
commentsConfig: CommentRule,
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(OUTER_LANGUAGE_ID);
this._register(LanguageConfigurationRegistry.register(this.languageId, {
@ -1096,7 +1096,7 @@ suite('Editor Contrib - Line Comment in mixed modes', () => {
},
tokenize2: (line: string, hasEOL: boolean, state: IState): TokenizationResult2 => {
const languageId = (/^ /.test(line) ? INNER_LANGUAGE_ID : OUTER_LANGUAGE_ID);
const encodedLanguageId = modeService.languageIdCodec.encodeLanguageId(languageId);
const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(languageId);
const tokens = new Uint32Array(1 << 1);
tokens[(0 << 1)] = 0;

View file

@ -21,7 +21,7 @@ import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IModelDeltaDecoration, ITextModel, IWordAtPosition } from 'vs/editor/common/model';
import { IFoundBracket } from 'vs/editor/common/model/bracketPairsTextModelPart/bracketPairs';
import { DefinitionProviderRegistry, LocationLink } from 'vs/editor/common/modes';
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 { ClickLinkGesture, ClickLinkKeyboardEvent, ClickLinkMouseEvent } from 'vs/editor/contrib/gotoSymbol/link/clickLinkGesture';
import { PeekContext } from 'vs/editor/contrib/peekView/peekView';
@ -48,7 +48,7 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
constructor(
editor: ICodeEditor,
@ITextModelService private readonly textModelResolverService: ITextModelService,
@IModeService private readonly modeService: IModeService
@ILanguageService private readonly languageService: ILanguageService
) {
this.editor = editor;
@ -204,7 +204,7 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
wordRange = new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
}
const languageId = this.modeService.getModeIdByFilepathOrFirstLine(textEditorModel.uri);
const languageId = this.languageService.getModeIdByFilepathOrFirstLine(textEditorModel.uri);
this.addDecoration(
wordRange,
new MarkdownString().appendCodeblock(languageId ? languageId : '', previewValue)

View file

@ -24,7 +24,7 @@ import { IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/
import { ModelDecorationOptions, TextModel } from 'vs/editor/common/model/textModel';
import { Location } from 'vs/editor/common/modes';
import { ILanguageConfigurationService } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ITextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService';
import { AccessibilityProvider, DataSource, Delegate, FileReferencesRenderer, IdentityProvider, OneReferenceRenderer, StringRepresentationProvider, TreeElement } from 'vs/editor/contrib/gotoSymbol/peek/referencesTree';
import * as peekView from 'vs/editor/contrib/peekView/peekView';
@ -223,7 +223,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
@ILabelService private readonly _uriLabel: ILabelService,
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,
) {
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true, supportOnTitleClick: true }, _instantiationService);
@ -313,7 +313,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
};
this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewContainer, options, this.editor);
dom.hide(this._previewContainer);
this._previewNotAvailableMessage = new TextModel(nls.localize('missingPreviewMessage', "no preview available"), TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService, this._modeService, this._languageConfigurationService);
this._previewNotAvailableMessage = new TextModel(nls.localize('missingPreviewMessage', "no preview available"), TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService, this._languageService, this._languageConfigurationService);
// tree
this._treeContainer = dom.append(containerElement, dom.$('div.ref-tree.inline'));

View file

@ -12,7 +12,7 @@ import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config
import { Range } from 'vs/editor/common/core/range';
import { IEditorContribution, IScrollEvent } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { GotoDefinitionAtPositionEditorContribution } from 'vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition';
import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation';
import { ModesContentHoverWidget } from 'vs/editor/contrib/hover/modesContentHover';
@ -50,7 +50,7 @@ export class ModesHoverController implements IEditorContribution {
constructor(private readonly _editor: ICodeEditor,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IOpenerService private readonly _openerService: IOpenerService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IContextKeyService _contextKeyService: IContextKeyService
) {
this._isMouseDown = false;
@ -178,7 +178,7 @@ export class ModesHoverController implements IEditorContribution {
if (targetType === MouseTargetType.GUTTER_GLYPH_MARGIN && mouseEvent.target.position) {
this._contentWidget?.hide();
if (!this._glyphWidget) {
this._glyphWidget = new ModesGlyphHoverWidget(this._editor, this._modeService, this._openerService);
this._glyphWidget = new ModesGlyphHoverWidget(this._editor, this._languageService, this._openerService);
}
this._glyphWidget.startShowingAt(mouseEvent.target.position.lineNumber);
return;

View file

@ -15,7 +15,7 @@ import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { IModelDecoration } from 'vs/editor/common/model';
import { HoverProviderRegistry } from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { getHover } from 'vs/editor/contrib/hover/getHover';
import { HoverAnchor, HoverAnchorType, IEditorHover, IEditorHoverParticipant, IEditorHoverStatusBar, IHoverPart } from 'vs/editor/contrib/hover/hoverTypes';
import * as nls from 'vs/nls';
@ -47,7 +47,7 @@ export class MarkdownHoverParticipant implements IEditorHoverParticipant<Markdow
constructor(
private readonly _editor: ICodeEditor,
private readonly _hover: IEditorHover,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IOpenerService private readonly _openerService: IOpenerService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) { }
@ -116,7 +116,7 @@ export class MarkdownHoverParticipant implements IEditorHoverParticipant<Markdow
}
public renderHoverParts(hoverParts: MarkdownHover[], fragment: DocumentFragment, statusBar: IEditorHoverStatusBar): IDisposable {
return renderMarkdownHovers(hoverParts, fragment, this._editor, this._hover, this._modeService, this._openerService);
return renderMarkdownHovers(hoverParts, fragment, this._editor, this._hover, this._languageService, this._openerService);
}
}
@ -125,7 +125,7 @@ export function renderMarkdownHovers(
fragment: DocumentFragment,
editor: ICodeEditor,
hover: IEditorHover,
modeService: IModeService,
languageService: ILanguageService,
openerService: IOpenerService,
): IDisposable {
@ -140,7 +140,7 @@ export function renderMarkdownHovers(
}
const markdownHoverElement = $('div.hover-row.markdown-hover');
const hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));
const renderer = disposables.add(new MarkdownRenderer({ editor }, modeService, openerService));
const renderer = disposables.add(new MarkdownRenderer({ editor }, languageService, openerService));
disposables.add(renderer.onDidRenderAsync(() => {
hoverContentsElement.className = 'hover-contents code-hover-contents';
hover.onContentsChanged();

View file

@ -10,7 +10,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { HoverOperation, HoverStartMode, IHoverComputer } from 'vs/editor/contrib/hover/hoverOperation';
import { Widget } from 'vs/base/browser/ui/widget';
import { IOpenerService, NullOpenerService } from 'vs/platform/opener/common/opener';
@ -105,7 +105,7 @@ export class ModesGlyphHoverWidget extends Widget implements IOverlayWidget {
constructor(
editor: ICodeEditor,
modeService: IModeService,
languageService: ILanguageService,
openerService: IOpenerService = NullOpenerService,
) {
super();
@ -118,7 +118,7 @@ export class ModesGlyphHoverWidget extends Widget implements IOverlayWidget {
this._hover = this._register(new HoverWidget());
this._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);
this._markdownRenderer = this._register(new MarkdownRenderer({ editor: this._editor }, modeService, openerService));
this._markdownRenderer = this._register(new MarkdownRenderer({ editor: this._editor }, languageService, openerService));
this._computer = new MarginComputer(this._editor);
this._hoverOperation = new HoverOperation(
this._computer,

View file

@ -16,7 +16,7 @@ import { Range } from 'vs/editor/common/core/range';
import { createStringBuilder } from 'vs/editor/common/core/stringBuilder';
import { IModelDeltaDecoration } from 'vs/editor/common/model';
import { ILanguageIdCodec } from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ghostTextBackground, ghostTextBorder, ghostTextForeground } from 'vs/editor/common/view/editorColorRegistry';
import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { RenderLineInput, renderViewLine } from 'vs/editor/common/viewLayout/viewLineRenderer';
@ -30,14 +30,14 @@ const ttPolicy = window.trustedTypes?.createPolicy('editorGhostText', { createHT
export class GhostTextWidget extends Disposable {
private disposed = false;
private readonly partsWidget = this._register(this.instantiationService.createInstance(DecorationsWidget, this.editor));
private readonly additionalLinesWidget = this._register(new AdditionalLinesWidget(this.editor, this.modeService.languageIdCodec));
private readonly additionalLinesWidget = this._register(new AdditionalLinesWidget(this.editor, this.languageService.languageIdCodec));
private viewMoreContentWidget: ViewMoreLinesContentWidget | undefined = undefined;
constructor(
private readonly editor: ICodeEditor,
private readonly model: GhostTextWidgetModel,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
) {
super();

View file

@ -11,7 +11,7 @@ import { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
import { Range } from 'vs/editor/common/core/range';
import { IModelDecoration } from 'vs/editor/common/model';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { HoverAnchor, HoverAnchorType, HoverForeignElementAnchor, IEditorHover, IEditorHoverParticipant, IEditorHoverStatusBar, IHoverPart } from 'vs/editor/contrib/hover/hoverTypes';
import { commitInlineSuggestionAction, GhostTextController, ShowNextInlineSuggestionAction, ShowPreviousInlineSuggestionAction } from 'vs/editor/contrib/inlineCompletions/ghostTextController';
import * as nls from 'vs/nls';
@ -48,7 +48,7 @@ export class InlineCompletionsHoverParticipant implements IEditorHoverParticipan
@ICommandService private readonly _commandService: ICommandService,
@IMenuService private readonly _menuService: IMenuService,
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IOpenerService private readonly _openerService: IOpenerService,
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
) { }
@ -147,7 +147,7 @@ export class InlineCompletionsHoverParticipant implements IEditorHoverParticipan
const $ = dom.$;
const markdownHoverElement = $('div.hover-row.markdown-hover');
const hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));
const renderer = disposableStore.add(new MarkdownRenderer({ editor: this._editor }, this._modeService, this._openerService));
const renderer = disposableStore.add(new MarkdownRenderer({ editor: this._editor }, this._languageService, this._openerService));
const render = (code: string) => {
disposableStore.add(renderer.onDidRenderAsync(() => {
hoverContentsElement.className = 'hover-contents code-hover-contents';

View file

@ -17,7 +17,7 @@ import { IMarkdownRenderResult, MarkdownRenderer } from 'vs/editor/browser/core/
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { ConfigurationChangedEvent, EditorOption } from 'vs/editor/common/config/editorOptions';
import * as modes from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel';
import { Context } from 'vs/editor/contrib/parameterHints/provideSignatureHelp';
import * as nls from 'vs/nls';
@ -61,10 +61,10 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
private readonly editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@IOpenerService openerService: IOpenerService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
) {
super();
this.markdownRenderer = this._register(new MarkdownRenderer({ editor }, modeService, openerService));
this.markdownRenderer = this._register(new MarkdownRenderer({ editor }, languageService, openerService));
this.model = this._register(new ParameterHintsModel(editor));
this.keyVisible = Context.Visible.bindTo(contextKeyService);
this.keyMultipleSignatures = Context.MultipleSignatures.bindTo(contextKeyService);

View file

@ -18,7 +18,7 @@ import { EditorOption, EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/edit
import { CompletionItemKind, CompletionItemTag, completionKindToCssClass } from 'vs/editor/common/modes';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
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 * as nls from 'vs/nls';
import { FileKind } from 'vs/platform/files/common/files';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
@ -93,7 +93,7 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
constructor(
private readonly _editor: ICodeEditor,
@IModelService private readonly _modelService: IModelService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IThemeService private readonly _themeService: IThemeService
) { }
@ -182,8 +182,8 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
// special logic for 'file' completion items
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
const labelClasses = getIconClasses(this._modelService, this._modeService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FILE);
const detailClasses = getIconClasses(this._modelService, this._modeService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FILE);
const labelClasses = getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FILE);
const detailClasses = getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FILE);
labelOptions.extraClasses = labelClasses.length > detailClasses.length ? labelClasses : detailClasses;
} else if (completion.kind === CompletionItemKind.Folder && this._themeService.getFileIconTheme().hasFolderIcons) {
@ -191,8 +191,8 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
labelOptions.extraClasses = flatten([
getIconClasses(this._modelService, this._modeService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FOLDER),
getIconClasses(this._modelService, this._modeService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FOLDER)
getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: element.textLabel }), FileKind.FOLDER),
getIconClasses(this._modelService, this._languageService, URI.from({ scheme: 'fake', path: completion.detail }), FileKind.FOLDER)
]);
} else {
// normal icon

View file

@ -20,7 +20,7 @@ import { CompletionItemKind, CompletionItemProvider, CompletionList, CompletionP
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2';
import { SuggestController } from 'vs/editor/contrib/suggest/suggestController';
import { ISuggestMemoryService } from 'vs/editor/contrib/suggest/suggestMemory';
@ -71,7 +71,7 @@ suite('SuggestModel - Context', function () {
class OuterMode extends MockMode {
constructor(
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(OUTER_LANGUAGE_ID);
this._register(LanguageConfigurationRegistry.register(this.languageId, {}));
@ -84,7 +84,7 @@ suite('SuggestModel - Context', function () {
let prevLanguageId: string | undefined = undefined;
for (let i = 0; i < line.length; i++) {
const languageId = (line.charAt(i) === 'x' ? INNER_LANGUAGE_ID : OUTER_LANGUAGE_ID);
const encodedLanguageId = modeService.languageIdCodec.encodeLanguageId(languageId);
const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(languageId);
if (prevLanguageId !== languageId) {
tokensArr.push(i);
tokensArr.push((encodedLanguageId << MetadataConsts.LANGUAGEID_OFFSET));

View file

@ -19,7 +19,7 @@ import { IModelDecoration, IModelDeltaDecoration, ITextModel, MinimapPosition, O
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { UnicodeHighlighterOptions, UnicodeHighlighterReason, UnicodeHighlighterReasonKind, UnicodeTextModelHighlighter } from 'vs/editor/common/modes/unicodeTextModelHighlighter';
import { IEditorWorkerService, IUnicodeHighlightsResult } from 'vs/editor/common/services/editorWorkerService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { isModelDecorationVisible } from 'vs/editor/common/viewModel/viewModelDecorations';
import { HoverAnchor, HoverAnchorType, IEditorHover, IEditorHoverParticipant, IEditorHoverStatusBar, IHoverPart } from 'vs/editor/contrib/hover/hoverTypes';
import { MarkdownHover, renderMarkdownHovers } from 'vs/editor/contrib/hover/markdownHoverParticipant';
@ -397,7 +397,7 @@ export class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipa
constructor(
private readonly _editor: ICodeEditor,
private readonly _hover: IEditorHover,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IOpenerService private readonly _openerService: IOpenerService,
) {
}
@ -482,7 +482,7 @@ export class UnicodeHighlighterHoverParticipant implements IEditorHoverParticipa
}
public renderHoverParts(hoverParts: MarkdownHover[], fragment: DocumentFragment, statusBar: IEditorHoverStatusBar): IDisposable {
return renderMarkdownHovers(hoverParts, fragment, this._editor, this._hover, this._modeService, this._openerService);
return renderMarkdownHovers(hoverParts, fragment, this._editor, this._hover, this._languageService, this._openerService);
}
}

View file

@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings';
import { IViewLineTokens, LineTokens } from 'vs/editor/common/core/lineTokens';
import { ITextModel } from 'vs/editor/common/model';
import { ColorId, FontStyle, ILanguageIdCodec, ITokenizationSupport, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { RenderLineInput, renderViewLine2 as renderViewLine } from 'vs/editor/common/viewLayout/viewLineRenderer';
import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
@ -28,7 +28,7 @@ export interface IColorizerElementOptions extends IColorizerOptions {
export class Colorizer {
public static colorizeElement(themeService: IStandaloneThemeService, modeService: IModeService, domNode: HTMLElement, options: IColorizerElementOptions): Promise<void> {
public static colorizeElement(themeService: IStandaloneThemeService, languageService: ILanguageService, domNode: HTMLElement, options: IColorizerElementOptions): Promise<void> {
options = options || {};
let theme = options.theme || 'vs';
let mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');
@ -45,11 +45,11 @@ export class Colorizer {
const trustedhtml = ttPolicy?.createHTML(str) ?? str;
domNode.innerHTML = trustedhtml as string;
};
return this.colorize(modeService, text || '', mimeType, options).then(render, (err) => console.error(err));
return this.colorize(languageService, text || '', mimeType, options).then(render, (err) => console.error(err));
}
public static colorize(modeService: IModeService, text: string, mimeType: string, options: IColorizerOptions | null | undefined): Promise<string> {
const languageIdCodec = modeService.languageIdCodec;
public static colorize(languageService: ILanguageService, text: string, mimeType: string, options: IColorizerOptions | null | undefined): Promise<string> {
const languageIdCodec = languageService.languageIdCodec;
let tabSize = 4;
if (options && typeof options.tabSize === 'number') {
tabSize = options.tabSize;
@ -59,13 +59,13 @@ export class Colorizer {
text = text.substr(1);
}
let lines = strings.splitLines(text);
let language = modeService.getModeId(mimeType);
let language = languageService.getModeId(mimeType);
if (!language) {
return Promise.resolve(_fakeColorize(lines, tabSize, languageIdCodec));
}
// Send out the event to create the mode
modeService.triggerMode(language);
languageService.triggerMode(language);
const tokenizationSupport = TokenizationRegistry.get(language);
if (tokenizationSupport) {

View file

@ -17,7 +17,7 @@ import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { FontStyle, IState, ITokenizationSupport, StandardTokenType, TokenMetadata, TokenizationRegistry, ILanguageIdCodec } from 'vs/editor/common/modes';
import { NULL_STATE, nullTokenize, nullTokenize2 } from 'vs/editor/common/modes/nullMode';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@ -34,17 +34,17 @@ class InspectTokensController extends Disposable implements IEditorContribution
}
private readonly _editor: ICodeEditor;
private readonly _modeService: IModeService;
private readonly _languageService: ILanguageService;
private _widget: InspectTokensWidget | null;
constructor(
editor: ICodeEditor,
@IStandaloneThemeService standaloneColorService: IStandaloneThemeService,
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super();
this._editor = editor;
this._modeService = modeService;
this._languageService = languageService;
this._widget = null;
this._register(this._editor.onDidChangeModel((e) => this.stop()));
@ -65,7 +65,7 @@ class InspectTokensController extends Disposable implements IEditorContribution
if (!this._editor.hasModel()) {
return;
}
this._widget = new InspectTokensWidget(this._editor, this._modeService);
this._widget = new InspectTokensWidget(this._editor, this._languageService);
}
public stop(): void {
@ -151,22 +151,22 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
public allowEditorOverflow = true;
private readonly _editor: IActiveCodeEditor;
private readonly _modeService: IModeService;
private readonly _languageService: ILanguageService;
private readonly _tokenizationSupport: ITokenizationSupport;
private readonly _model: ITextModel;
private readonly _domNode: HTMLElement;
constructor(
editor: IActiveCodeEditor,
modeService: IModeService
languageService: ILanguageService
) {
super();
this._editor = editor;
this._modeService = modeService;
this._languageService = languageService;
this._model = this._editor.getModel();
this._domNode = document.createElement('div');
this._domNode.className = 'tokens-inspect-widget';
this._tokenizationSupport = getSafeTokenizationSupport(this._modeService.languageIdCodec, this._model.getLanguageId());
this._tokenizationSupport = getSafeTokenizationSupport(this._languageService.languageIdCodec, this._model.getLanguageId());
this._compute(this._editor.getPosition());
this._register(this._editor.onDidChangeCursorPosition((e) => this._compute(this._editor.getPosition())));
this._editor.addContentWidget(this);
@ -256,7 +256,7 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
let foreground = TokenMetadata.getForeground(metadata);
let background = TokenMetadata.getBackground(metadata);
return {
languageId: this._modeService.languageIdCodec.decodeLanguageId(languageId),
languageId: this._languageService.languageIdCodec.decodeLanguageId(languageId),
tokenType: tokenType,
fontStyle: fontStyle,
foreground: colorMap[foreground],

View file

@ -32,7 +32,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { StandaloneThemeServiceImpl } from 'vs/editor/standalone/browser/standaloneThemeServiceImpl';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/services/languageService';
import { URI } from 'vs/base/common/uri';
import { StandaloneCodeEditorServiceImpl } from 'vs/editor/standalone/browser/standaloneCodeServiceImpl';
import { Mimes } from 'vs/base/common/mime';
@ -414,7 +414,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
@IConfigurationService configurationService: IConfigurationService,
@IAccessibilityService accessibilityService: IAccessibilityService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
) {
const options = { ..._options };
updateConfigurationService(configurationService, options, false);
@ -437,7 +437,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
let model: ITextModel | null;
if (typeof _model === 'undefined') {
model = createTextModel(modelService, modeService, options.value || '', options.language || Mimes.text, undefined);
model = createTextModel(modelService, languageService, options.value || '', options.language || Mimes.text, undefined);
this._ownsModel = true;
} else {
model = _model;
@ -573,7 +573,7 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
/**
* @internal
*/
export function createTextModel(modelService: IModelService, modeService: IModeService, value: string, language: string | undefined, uri: URI | undefined): ITextModel {
export function createTextModel(modelService: IModelService, languageService: ILanguageService, value: string, language: string | undefined, uri: URI | undefined): ITextModel {
value = value || '';
if (!language) {
const firstLF = value.indexOf('\n');
@ -581,9 +581,9 @@ export function createTextModel(modelService: IModelService, modeService: IModeS
if (firstLF !== -1) {
firstLine = value.substring(0, firstLF);
}
return doCreateModel(modelService, value, modeService.createByFilepathOrFirstLine(uri || null, firstLine), uri);
return doCreateModel(modelService, value, languageService.createByFilepathOrFirstLine(uri || null, firstLine), uri);
}
return doCreateModel(modelService, value, modeService.create(language), uri);
return doCreateModel(modelService, value, languageService.create(language), uri);
}
/**

View file

@ -18,7 +18,7 @@ import { FindMatch, ITextModel, TextModelResolvedOptions } from 'vs/editor/commo
import * as modes from 'vs/editor/common/modes';
import { NULL_STATE, nullTokenize } from 'vs/editor/common/modes/nullMode';
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
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 { IWebWorkerOptions, MonacoWebWorker, createWebWorker as actualCreateWebWorker } from 'vs/editor/common/services/webWorker';
import * as standaloneEnums from 'vs/editor/common/standalone/standaloneEnums';
@ -90,7 +90,7 @@ export function create(domElement: HTMLElement, options?: IStandaloneEditorConst
services.get(IConfigurationService),
services.get(IAccessibilityService),
services.get(IModelService),
services.get(IModeService),
services.get(ILanguageService),
);
});
}
@ -150,7 +150,7 @@ export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: ID
export function createModel(value: string, language?: string, uri?: URI): ITextModel {
return createTextModel(
StaticServices.modelService.get(),
StaticServices.modeService.get(),
StaticServices.languageService.get(),
value,
language,
uri
@ -161,7 +161,7 @@ export function createModel(value: string, language?: string, uri?: URI): ITextM
* Change the language for a model.
*/
export function setModelLanguage(model: ITextModel, languageId: string): void {
StaticServices.modelService.get().setMode(model, StaticServices.modeService.get().create(languageId));
StaticServices.modelService.get().setMode(model, StaticServices.languageService.get().create(languageId));
}
/**
@ -247,7 +247,7 @@ export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void> {
const themeService = <StandaloneThemeServiceImpl>StaticServices.standaloneThemeService.get();
themeService.registerEditorContainer(domNode);
return Colorizer.colorizeElement(themeService, StaticServices.modeService.get(), domNode, options);
return Colorizer.colorizeElement(themeService, StaticServices.languageService.get(), domNode, options);
}
/**
@ -256,7 +256,7 @@ export function colorizeElement(domNode: HTMLElement, options: IColorizerElement
export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string> {
const themeService = <StandaloneThemeServiceImpl>StaticServices.standaloneThemeService.get();
themeService.registerEditorContainer(document.body);
return Colorizer.colorize(StaticServices.modeService.get(), text, languageId, options);
return Colorizer.colorize(StaticServices.languageService.get(), text, languageId, options);
}
/**
@ -286,9 +286,9 @@ function getSafeTokenizationSupport(language: string): Omit<modes.ITokenizationS
* Tokenize `text` using language `languageId`
*/
export function tokenize(text: string, languageId: string): Token[][] {
let modeService = StaticServices.modeService.get();
let languageService = StaticServices.languageService.get();
// Needed in order to get the mode registered for subsequent look-ups
modeService.triggerMode(languageId);
languageService.triggerMode(languageId);
let tokenizationSupport = getSafeTokenizationSupport(languageId);
let lines = splitLines(text);

View file

@ -14,7 +14,7 @@ import * as modes from 'vs/editor/common/modes';
import { LanguageConfiguration } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
import { ILanguageExtensionPoint, IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageExtensionPoint, ILanguageService } from 'vs/editor/common/services/languageService';
import * as standaloneEnums from 'vs/editor/common/standalone/standaloneEnums';
import { StaticServices } from 'vs/editor/standalone/browser/standaloneServices';
import { compile } from 'vs/editor/standalone/common/monarch/monarchCompile';
@ -40,8 +40,8 @@ export function getLanguages(): ILanguageExtensionPoint[] {
}
export function getEncodedLanguageId(languageId: string): number {
const modeService = StaticServices.modeService.get();
return modeService.languageIdCodec.encodeLanguageId(languageId);
const languageService = StaticServices.languageService.get();
return languageService.languageIdCodec.encodeLanguageId(languageId);
}
/**
@ -49,7 +49,7 @@ export function getEncodedLanguageId(languageId: string): number {
* @event
*/
export function onLanguage(languageId: string, callback: () => void): IDisposable {
let disposable = StaticServices.modeService.get().onDidEncounterLanguage((encounteredLanguageId) => {
let disposable = StaticServices.languageService.get().onDidEncounterLanguage((encounteredLanguageId) => {
if (encounteredLanguageId === languageId) {
// stop listening
disposable.dispose();
@ -64,7 +64,7 @@ export function onLanguage(languageId: string, callback: () => void): IDisposabl
* Set the editing configuration for a language.
*/
export function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable {
const validLanguageId = StaticServices.modeService.get().validateLanguageId(languageId);
const validLanguageId = StaticServices.languageService.get().validateLanguageId(languageId);
if (!validLanguageId) {
throw new Error(`Cannot set configuration for unknown language ${languageId}`);
}
@ -109,7 +109,7 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
constructor(
private readonly _languageId: string,
private readonly _actual: TokensProvider,
private readonly _modeService: IModeService,
private readonly _languageService: ILanguageService,
private readonly _standaloneThemeService: IStandaloneThemeService,
) {
}
@ -200,7 +200,7 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
public tokenize2(line: string, hasEOL: boolean, state: modes.IState, offsetDelta: number): TokenizationResult2 {
let actualResult = this._actual.tokenize(line, state);
let tokens = this._toBinaryTokens(this._modeService.languageIdCodec, actualResult.tokens, offsetDelta);
let tokens = this._toBinaryTokens(this._languageService.languageIdCodec, actualResult.tokens, offsetDelta);
let endState: modes.IState;
// try to save an object if possible
@ -329,7 +329,7 @@ export function setColorMap(colorMap: string[] | null): void {
* Set the tokens provider for a language (manual implementation).
*/
export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable<TokensProvider | EncodedTokensProvider>): IDisposable {
const validLanguageId = StaticServices.modeService.get().validateLanguageId(languageId);
const validLanguageId = StaticServices.languageService.get().validateLanguageId(languageId);
if (!validLanguageId) {
throw new Error(`Cannot set tokens provider for unknown language ${languageId}`);
}
@ -340,7 +340,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider |
return new TokenizationSupport2Adapter(
validLanguageId,
provider,
StaticServices.modeService.get(),
StaticServices.languageService.get(),
StaticServices.standaloneThemeService.get(),
);
}
@ -357,7 +357,7 @@ export function setTokensProvider(languageId: string, provider: TokensProvider |
*/
export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable<IMonarchLanguage>): IDisposable {
const create = (languageDef: IMonarchLanguage) => {
return createTokenizationSupport(StaticServices.modeService.get(), StaticServices.standaloneThemeService.get(), languageId, compile(languageId, languageDef));
return createTokenizationSupport(StaticServices.languageService.get(), StaticServices.standaloneThemeService.get(), languageId, compile(languageId, languageDef));
};
if (isThenable<IMonarchLanguage>(languageDef)) {
return modes.TokenizationRegistry.registerPromise(languageId, languageDef.then(languageDef => create(languageDef)));

View file

@ -8,7 +8,7 @@ import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
import { EditorWorkerServiceImpl } from 'vs/editor/common/services/editorWorkerServiceImpl';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
@ -150,7 +150,7 @@ export module StaticServices {
export const markerService = define(IMarkerService, () => new MarkerService());
export const modeService = define(IModeService, (o) => new ModeServiceImpl());
export const languageService = define(ILanguageService, (o) => new ModeServiceImpl());
export const standaloneThemeService = define(IStandaloneThemeService, () => new StandaloneThemeServiceImpl());
@ -158,7 +158,7 @@ export module StaticServices {
export const undoRedoService = define(IUndoRedoService, (o) => new UndoRedoService(dialogService.get(o), notificationService.get(o)));
export const languageConfigurationService = define(ILanguageConfigurationService, (o) => new LanguageConfigurationService(configurationService.get(o), modeService.get(o)));
export const languageConfigurationService = define(ILanguageConfigurationService, (o) => new LanguageConfigurationService(configurationService.get(o), languageService.get(o)));
export const modelService = define(
IModelService,
@ -169,7 +169,7 @@ export module StaticServices {
standaloneThemeService.get(o),
logService.get(o),
undoRedoService.get(o),
modeService.get(o),
languageService.get(o),
languageConfigurationService.get(o)
)
);

View file

@ -13,7 +13,7 @@ import { Token, TokenizationResult, TokenizationResult2 } from 'vs/editor/common
import * as modes from 'vs/editor/common/modes';
import { NULL_MODE_ID, NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { TokenTheme } from 'vs/editor/common/modes/supports/tokenization';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import * as monarchCommon from 'vs/editor/standalone/common/monarch/monarchCommon';
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
@ -287,15 +287,15 @@ class MonarchClassicTokensCollector implements IMonarchTokensCollector {
class MonarchModernTokensCollector implements IMonarchTokensCollector {
private readonly _modeService: IModeService;
private readonly _languageService: ILanguageService;
private readonly _theme: TokenTheme;
private _prependTokens: Uint32Array | null;
private _tokens: number[];
private _currentLanguageId: modes.LanguageId;
private _lastTokenMetadata: number;
constructor(modeService: IModeService, theme: TokenTheme) {
this._modeService = modeService;
constructor(languageService: ILanguageService, theme: TokenTheme) {
this._languageService = languageService;
this._theme = theme;
this._prependTokens = null;
this._tokens = [];
@ -304,7 +304,7 @@ class MonarchModernTokensCollector implements IMonarchTokensCollector {
}
public enterMode(startOffset: number, languageId: string): void {
this._currentLanguageId = this._modeService.languageIdCodec.encodeLanguageId(languageId);
this._currentLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
}
public emit(startOffset: number, type: string): void {
@ -376,7 +376,7 @@ export type ILoadStatus = { loaded: true; } | { loaded: false; promise: Promise<
export class MonarchTokenizer implements modes.ITokenizationSupport {
private readonly _modeService: IModeService;
private readonly _languageService: ILanguageService;
private readonly _standaloneThemeService: IStandaloneThemeService;
private readonly _languageId: string;
private readonly _lexer: monarchCommon.ILexer;
@ -384,8 +384,8 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
public embeddedLoaded: Promise<void>;
private readonly _tokenizationRegistryListener: IDisposable;
constructor(modeService: IModeService, standaloneThemeService: IStandaloneThemeService, languageId: string, lexer: monarchCommon.ILexer) {
this._modeService = modeService;
constructor(languageService: ILanguageService, standaloneThemeService: IStandaloneThemeService, languageId: string, lexer: monarchCommon.ILexer) {
this._languageService = languageService;
this._standaloneThemeService = standaloneThemeService;
this._languageId = languageId;
this._lexer = lexer;
@ -463,7 +463,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
}
public tokenize2(line: string, hasEOL: boolean, lineState: modes.IState, offsetDelta: number): TokenizationResult2 {
let tokensCollector = new MonarchModernTokensCollector(this._modeService, this._standaloneThemeService.getColorTheme().tokenTheme);
let tokensCollector = new MonarchModernTokensCollector(this._languageService, this._standaloneThemeService.getColorTheme().tokenTheme);
let endLineState = this._tokenize(line, hasEOL, <MonarchLineState>lineState, offsetDelta, tokensCollector);
return tokensCollector.finalize(endLineState);
}
@ -745,7 +745,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
const computeNewStateForEmbeddedMode = (enteringEmbeddedMode: string) => {
// substitute language alias to known modes to support syntax highlighting
let enteringEmbeddedModeId = this._modeService.getModeIdForLanguageName(enteringEmbeddedMode);
let enteringEmbeddedModeId = this._languageService.getModeIdForLanguageName(enteringEmbeddedMode);
if (enteringEmbeddedModeId) {
enteringEmbeddedMode = enteringEmbeddedModeId;
}
@ -859,7 +859,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
}
private _locateMode(mimetypeOrModeId: string): string | null {
if (!mimetypeOrModeId || !this._modeService.isRegisteredMode(mimetypeOrModeId)) {
if (!mimetypeOrModeId || !this._languageService.isRegisteredMode(mimetypeOrModeId)) {
return null;
}
@ -868,11 +868,11 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
return mimetypeOrModeId;
}
const languageId = this._modeService.getModeId(mimetypeOrModeId);
const languageId = this._languageService.getModeId(mimetypeOrModeId);
if (languageId) {
// Fire mode loading event
this._modeService.triggerMode(languageId);
this._languageService.triggerMode(languageId);
this._embeddedModes[languageId] = true;
}
@ -902,6 +902,6 @@ function findBracket(lexer: monarchCommon.ILexer, matched: string) {
return null;
}
export function createTokenizationSupport(modeService: IModeService, standaloneThemeService: IStandaloneThemeService, languageId: string, lexer: monarchCommon.ILexer): modes.ITokenizationSupport {
return new MonarchTokenizer(modeService, standaloneThemeService, languageId, lexer);
export function createTokenizationSupport(languageService: ILanguageService, standaloneThemeService: IStandaloneThemeService, languageId: string, lexer: monarchCommon.ILexer): modes.ITokenizationSupport {
return new MonarchTokenizer(languageService, standaloneThemeService, languageId, lexer);
}

View file

@ -113,12 +113,12 @@ suite('TokenizationSupport2Adapter', () => {
}
const disposables = new DisposableStore();
const modeService = disposables.add(new ModeServiceImpl());
const languageService = disposables.add(new ModeServiceImpl());
disposables.add(ModesRegistry.registerLanguage({ id: languageId }));
const adapter = new TokenizationSupport2Adapter(
languageId,
new BadTokensProvider(),
modeService,
languageService,
new MockThemeService()
);
@ -132,7 +132,7 @@ suite('TokenizationSupport2Adapter', () => {
}
// Add the encoded language id to the expected tokens
const encodedLanguageId = modeService.languageIdCodec.encodeLanguageId(languageId);
const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(languageId);
const tokenLanguageMetadata = (encodedLanguageId << MetadataConsts.LANGUAGEID_OFFSET);
for (let i = 1; i < expectedModernTokens.length; i += 2) {
expectedModernTokens[i] |= tokenLanguageMetadata;

View file

@ -5,7 +5,7 @@
import * as assert from 'assert';
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { MonarchTokenizer } from 'vs/editor/standalone/common/monarch/monarchLexer';
import { compile } from 'vs/editor/standalone/common/monarch/monarchCompile';
import { Token } from 'vs/editor/common/core/token';
@ -15,8 +15,8 @@ import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
suite('Monarch', () => {
function createMonarchTokenizer(modeService: IModeService, languageId: string, language: IMonarchLanguage): MonarchTokenizer {
return new MonarchTokenizer(modeService, null!, languageId, compile(languageId, language));
function createMonarchTokenizer(languageService: ILanguageService, languageId: string, language: IMonarchLanguage): MonarchTokenizer {
return new MonarchTokenizer(languageService, null!, languageId, compile(languageId, language));
}
function getTokens(tokenizer: MonarchTokenizer, lines: string[]): Token[][] {
@ -31,11 +31,11 @@ suite('Monarch', () => {
}
test('Ensure @rematch and nextEmbedded can be used together in Monarch grammar', () => {
const modeService = new ModeServiceImpl();
const languageService = new ModeServiceImpl();
const innerModeRegistration = ModesRegistry.registerLanguage({
id: 'sql'
});
const innerModeTokenizationRegistration = TokenizationRegistry.register('sql', createMonarchTokenizer(modeService, 'sql', {
const innerModeTokenizationRegistration = TokenizationRegistry.register('sql', createMonarchTokenizer(languageService, 'sql', {
tokenizer: {
root: [
[/./, 'token']
@ -43,7 +43,7 @@ suite('Monarch', () => {
}
}));
const SQL_QUERY_START = '(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH)';
const tokenizer = createMonarchTokenizer(modeService, 'test1', {
const tokenizer = createMonarchTokenizer(languageService, 'test1', {
tokenizer: {
root: [
[`(\"\"\")${SQL_QUERY_START}`, [{ 'token': 'string.quote', }, { token: '@rematch', next: '@endStringWithSQL', nextEmbedded: 'sql', },]],
@ -106,12 +106,12 @@ suite('Monarch', () => {
]);
innerModeTokenizationRegistration.dispose();
innerModeRegistration.dispose();
modeService.dispose();
languageService.dispose();
});
test('microsoft/monaco-editor#1235: Empty Line Handling', () => {
const modeService = new ModeServiceImpl();
const tokenizer = createMonarchTokenizer(modeService, 'test', {
const languageService = new ModeServiceImpl();
const tokenizer = createMonarchTokenizer(languageService, 'test', {
tokenizer: {
root: [
{ include: '@comments' },
@ -162,13 +162,13 @@ suite('Monarch', () => {
[],
[new Token(0, 'source.test', 'test')]
]);
modeService.dispose();
languageService.dispose();
});
test('microsoft/monaco-editor#2265: Exit a state at end of line', () => {
const modeService = new ModeServiceImpl();
const tokenizer = createMonarchTokenizer(modeService, 'test', {
const languageService = new ModeServiceImpl();
const tokenizer = createMonarchTokenizer(languageService, 'test', {
includeLF: true,
tokenizer: {
root: [
@ -211,13 +211,13 @@ suite('Monarch', () => {
new Token(18, 'number.test', 'test'),
]
]);
modeService.dispose();
languageService.dispose();
});
test('issue #115662: monarchCompile function need an extra option which can control replacement', () => {
const modeService = new ModeServiceImpl();
const languageService = new ModeServiceImpl();
const tokenizer1 = createMonarchTokenizer(modeService, 'test', {
const tokenizer1 = createMonarchTokenizer(languageService, 'test', {
ignoreCase: false,
uselessReplaceKey1: '@uselessReplaceKey2',
uselessReplaceKey2: '@uselessReplaceKey3',
@ -236,7 +236,7 @@ suite('Monarch', () => {
},
});
const tokenizer2 = createMonarchTokenizer(modeService, 'test', {
const tokenizer2 = createMonarchTokenizer(languageService, 'test', {
ignoreCase: false,
tokenizer: {
root: [
@ -265,13 +265,13 @@ suite('Monarch', () => {
new Token(0, 'ham.test', 'test'),
]
]);
modeService.dispose();
languageService.dispose();
});
test('microsoft/monaco-editor#2424: Allow to target @@', () => {
const modeService = new ModeServiceImpl();
const languageService = new ModeServiceImpl();
const tokenizer = createMonarchTokenizer(modeService, 'test', {
const tokenizer = createMonarchTokenizer(languageService, 'test', {
ignoreCase: false,
tokenizer: {
root: [
@ -293,7 +293,7 @@ suite('Monarch', () => {
new Token(0, 'ham.test', 'test'),
]
]);
modeService.dispose();
languageService.dispose();
});
});

View file

@ -24,7 +24,7 @@ import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/javascriptOnEnterRules';
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
import { OutgoingViewModelEventKind } from 'vs/editor/common/viewModel/viewModelEventDispatcher';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { DisposableStore } from 'vs/base/common/lifecycle';
// --------- utils
@ -4771,7 +4771,7 @@ suite('autoClosingPairs', () => {
private static readonly _id = 'autoClosingMode';
constructor(modeService: IModeService | null = null) {
constructor(languageService: ILanguageService | null = null) {
super(AutoClosingMode._id);
this._register(LanguageConfigurationRegistry.register(this.languageId, {
autoClosingPairs: [
@ -4823,8 +4823,8 @@ suite('autoClosingPairs', () => {
}
type State = BaseState | StringState | BlockCommentState;
if (modeService) {
const encodedLanguageId = modeService.languageIdCodec.encodeLanguageId(this.languageId);
if (languageService) {
const encodedLanguageId = languageService.languageIdCodec.encodeLanguageId(this.languageId);
this._register(TokenizationRegistry.register(this.languageId, {
getInitialState: () => new BaseState(),
tokenize: undefined!,
@ -4977,8 +4977,8 @@ suite('autoClosingPairs', () => {
test('issue #132912: quotes should not auto-close if they are closing a string', () => {
const disposables = new DisposableStore();
const instantiationService = createCodeEditorServices(disposables);
const modeService = instantiationService.invokeFunction((accessor) => accessor.get(IModeService));
const mode = disposables.add(new AutoClosingMode(modeService));
const languageService = instantiationService.invokeFunction((accessor) => accessor.get(ILanguageService));
const mode = disposables.add(new AutoClosingMode(languageService));
withTestCodeEditor(
null,
{

View file

@ -15,7 +15,7 @@ import { ITextBufferFactory, ITextModel } from 'vs/editor/common/model';
import { ILanguageConfigurationService } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
@ -182,7 +182,7 @@ export function createCodeEditorServices(disposables: DisposableStore, services:
define(INotificationService, TestNotificationService);
define(IDialogService, TestDialogService);
define(IUndoRedoService, UndoRedoService);
define(IModeService, ModeServiceImpl);
define(ILanguageService, ModeServiceImpl);
define(ILanguageConfigurationService, TestLanguageConfigurationService);
define(IConfigurationService, TestConfigurationService);
define(ITextResourcePropertiesService, TestTextResourcePropertiesService);

View file

@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri';
import { BracketPairColorizationOptions, DefaultEndOfLine, ITextBufferFactory, ITextModelCreationOptions } from 'vs/editor/common/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { ILanguageConfigurationService } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { TestLanguageConfigurationService } from 'vs/editor/test/common/modes/testLanguageConfigurationService';
@ -94,7 +94,7 @@ export function createModelServices(disposables: DisposableStore, services: Serv
define(INotificationService, TestNotificationService);
define(IDialogService, TestDialogService);
define(IUndoRedoService, UndoRedoService);
define(IModeService, ModeServiceImpl);
define(ILanguageService, ModeServiceImpl);
define(ILanguageConfigurationService, TestLanguageConfigurationService);
define(IConfigurationService, TestConfigurationService);
define(ITextResourcePropertiesService, TestTextResourcePropertiesService);

View file

@ -6,7 +6,7 @@
import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
import { ILanguageSelection } from 'vs/editor/common/services/languageService';
export class MockMode extends Disposable {
constructor(

View file

@ -14,7 +14,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
import { IState, ITokenizationSupport, LanguageId, MetadataConsts, StandardTokenType, TokenizationRegistry } from 'vs/editor/common/modes';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { createModelServices, createTextModel2 } from 'vs/editor/test/common/editorTestUtils';
import { TestLanguageConfigurationService } from 'vs/editor/test/common/modes/testLanguageConfigurationService';
@ -23,9 +23,9 @@ suite('Bracket Pair Colorizer - Tokenizer', () => {
const mode1 = 'testMode1';
const disposableStore = new DisposableStore();
const instantiationService = createModelServices(disposableStore);
const modeService = instantiationService.invokeFunction((accessor) => accessor.get(IModeService));
const languageService = instantiationService.invokeFunction((accessor) => accessor.get(ILanguageService));
disposableStore.add(ModesRegistry.registerLanguage({ id: mode1 }));
const encodedMode1 = modeService.languageIdCodec.encodeLanguageId(mode1);
const encodedMode1 = languageService.languageIdCodec.encodeLanguageId(mode1);
const denseKeyProvider = new DenseKeyProvider<string>();

View file

@ -16,7 +16,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
import { createModelServices, createTextModel, createTextModel2 } from 'vs/editor/test/common/editorTestUtils';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
// --------- utils
@ -384,10 +384,10 @@ suite('Editor Model - Words', () => {
class OuterMode extends MockMode {
constructor(
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(OUTER_LANGUAGE_ID);
const languageIdCodec = modeService.languageIdCodec;
const languageIdCodec = languageService.languageIdCodec;
this._register(LanguageConfigurationRegistry.register(this.languageId, {}));

View file

@ -15,7 +15,7 @@ import { CharacterPair } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
import { NULL_STATE } from 'vs/editor/common/modes/nullMode';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ViewLineToken } from 'vs/editor/test/common/core/viewLineToken';
import { createModelServices, createTextModel, createTextModel2 } from 'vs/editor/test/common/editorTestUtils';
@ -350,7 +350,7 @@ suite('TextModelWithTokens', () => {
const mode1 = 'testMode1';
const mode2 = 'testMode2';
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(IModeService).languageIdCodec);
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(ILanguageService).languageIdCodec);
disposables.add(ModesRegistry.registerLanguage({ id: mode1 }));
disposables.add(ModesRegistry.registerLanguage({ id: mode2 }));
@ -453,7 +453,7 @@ suite('TextModelWithTokens', () => {
const instantiationService = createModelServices(disposables);
const mode = 'testMode';
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(IModeService).languageIdCodec);
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(ILanguageService).languageIdCodec);
const encodedMode = languageIdCodec!.encodeLanguageId(mode);
@ -673,7 +673,7 @@ suite('TextModelWithTokens regression tests', () => {
disposables.add(ModesRegistry.registerLanguage({ id: outerMode }));
disposables.add(ModesRegistry.registerLanguage({ id: innerMode }));
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(IModeService).languageIdCodec);
const languageIdCodec = instantiationService.invokeFunction((accessor) => accessor.get(ILanguageService).languageIdCodec);
const encodedInnerMode = languageIdCodec.encodeLanguageId(innerMode);
const tokenizationSupport: ITokenizationSupport = {

View file

@ -29,7 +29,7 @@ import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { ModesRegistry } from 'vs/editor/common/modes/modesRegistry';
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 { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/testTextResourcePropertiesService';
import { TestLanguageConfigurationService } from 'vs/editor/test/common/modes/testLanguageConfigurationService';
import { getDocumentSemanticTokens, isSemanticTokens } from 'vs/editor/common/services/getSemanticTokens';
@ -411,7 +411,7 @@ suite('ModelSemanticColoring', () => {
const disposables = new DisposableStore();
const ORIGINAL_FETCH_DOCUMENT_SEMANTIC_TOKENS_DELAY = ModelSemanticColoring.FETCH_DOCUMENT_SEMANTIC_TOKENS_DELAY;
let modelService: IModelService;
let modeService: IModeService;
let languageService: ILanguageService;
setup(() => {
ModelSemanticColoring.FETCH_DOCUMENT_SEMANTIC_TOKENS_DELAY = 0;
@ -428,7 +428,7 @@ suite('ModelSemanticColoring', () => {
disposables.add(new ModeServiceImpl()),
new TestLanguageConfigurationService()
));
modeService = disposables.add(new ModeServiceImpl(false));
languageService = disposables.add(new ModeServiceImpl(false));
});
teardown(() => {
@ -469,7 +469,7 @@ suite('ModelSemanticColoring', () => {
}
}));
const textModel = disposables.add(modelService.createModel('Hello world', modeService.create('testMode')));
const textModel = disposables.add(modelService.createModel('Hello world', languageService.create('testMode')));
// wait for the provider to be called
await inFirstCall.wait();
@ -532,7 +532,7 @@ suite('ModelSemanticColoring', () => {
return result;
}
const textModel = modelService.createModel('Hello world 2', modeService.create('testMode2'));
const textModel = modelService.createModel('Hello world 2', languageService.create('testMode2'));
try {
let result = await getDocumentSemanticTokens(textModel, null, null, CancellationToken.None);
assert.ok(result, `We should have tokens (1)`);

View file

@ -7,7 +7,7 @@ import * as assert from 'assert';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
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 { IConfigurationValue, IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { TextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationServiceImpl';
import { URI } from 'vs/base/common/uri';
@ -32,7 +32,7 @@ suite('TextResourceConfigurationService - Update', () => {
setup(() => {
const instantiationService = new TestInstantiationService();
instantiationService.stub(IModelService, <Partial<IModelService>>{ getModel() { return null; } });
instantiationService.stub(IModeService, <Partial<IModeService>>{ getModeIdByFilepathOrFirstLine() { return language; } });
instantiationService.stub(ILanguageService, <Partial<ILanguageService>>{ getModeIdByFilepathOrFirstLine() { return language; } });
instantiationService.stub(IConfigurationService, configurationService);
testObject = instantiationService.createInstance(TextResourceConfigurationService);
});

View file

@ -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;

View file

@ -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));
}

View file

@ -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();
}

View file

@ -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) {

View file

@ -17,7 +17,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { ILabelService } from 'vs/platform/label/common/label';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
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 { IRecent, isRecentFolder, isRecentWorkspace, IWorkspacesService, IWorkspaceIdentifier, isFolderBackupInfo, isWorkspaceBackupInfo } from 'vs/platform/workspaces/common/workspaces';
import { URI } from 'vs/base/common/uri';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
@ -75,7 +75,7 @@ abstract class BaseOpenRecentAction extends Action2 {
const labelService = accessor.get(ILabelService);
const keybindingService = accessor.get(IKeybindingService);
const modelService = accessor.get(IModelService);
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
const hostService = accessor.get(IHostService);
const dialogService = accessor.get(IDialogService);
@ -113,19 +113,19 @@ abstract class BaseOpenRecentAction extends Action2 {
for (const recent of recentlyOpened.workspaces) {
const isDirty = isRecentFolder(recent) ? dirtyFolders.has(recent.folderUri) : dirtyWorkspaces.has(recent.workspace.configPath);
workspacePicks.push(this.toQuickPick(modelService, modeService, labelService, recent, isDirty));
workspacePicks.push(this.toQuickPick(modelService, languageService, labelService, recent, isDirty));
}
// Fill any backup workspace that is not yet shown at the end
for (const dirtyWorkspaceOrFolder of dirtyWorkspacesAndFolders) {
if (isFolderBackupInfo(dirtyWorkspaceOrFolder) && !recentFolders.has(dirtyWorkspaceOrFolder.folderUri)) {
workspacePicks.push(this.toQuickPick(modelService, modeService, labelService, dirtyWorkspaceOrFolder, true));
workspacePicks.push(this.toQuickPick(modelService, languageService, labelService, dirtyWorkspaceOrFolder, true));
} else if (isWorkspaceBackupInfo(dirtyWorkspaceOrFolder) && !recentWorkspaces.has(dirtyWorkspaceOrFolder.workspace.configPath)) {
workspacePicks.push(this.toQuickPick(modelService, modeService, labelService, dirtyWorkspaceOrFolder, true));
workspacePicks.push(this.toQuickPick(modelService, languageService, labelService, dirtyWorkspaceOrFolder, true));
}
}
const filePicks = recentlyOpened.files.map(p => this.toQuickPick(modelService, modeService, labelService, p, false));
const filePicks = recentlyOpened.files.map(p => this.toQuickPick(modelService, languageService, labelService, p, false));
// focus second entry if the first recent workspace is the current workspace
const firstEntry = recentlyOpened.workspaces[0];
@ -182,7 +182,7 @@ abstract class BaseOpenRecentAction extends Action2 {
}
}
private toQuickPick(modelService: IModelService, modeService: IModeService, labelService: ILabelService, recent: IRecent, isDirty: boolean): IRecentlyOpenedPick {
private toQuickPick(modelService: IModelService, languageService: ILanguageService, labelService: ILabelService, recent: IRecent, isDirty: boolean): IRecentlyOpenedPick {
let openable: IWindowOpenable | undefined;
let iconClasses: string[];
let fullLabel: string | undefined;
@ -192,7 +192,7 @@ abstract class BaseOpenRecentAction extends Action2 {
// Folder
if (isRecentFolder(recent)) {
resource = recent.folderUri;
iconClasses = getIconClasses(modelService, modeService, resource, FileKind.FOLDER);
iconClasses = getIconClasses(modelService, languageService, resource, FileKind.FOLDER);
openable = { folderUri: resource };
fullLabel = recent.label || labelService.getWorkspaceLabel(resource, { verbose: true });
}
@ -200,7 +200,7 @@ abstract class BaseOpenRecentAction extends Action2 {
// Workspace
else if (isRecentWorkspace(recent)) {
resource = recent.workspace.configPath;
iconClasses = getIconClasses(modelService, modeService, resource, FileKind.ROOT_FOLDER);
iconClasses = getIconClasses(modelService, languageService, resource, FileKind.ROOT_FOLDER);
openable = { workspaceUri: resource };
fullLabel = recent.label || labelService.getWorkspaceLabel(recent.workspace, { verbose: true });
isWorkspace = true;
@ -209,7 +209,7 @@ abstract class BaseOpenRecentAction extends Action2 {
// File
else {
resource = recent.fileUri;
iconClasses = getIconClasses(modelService, modeService, resource, FileKind.FILE);
iconClasses = getIconClasses(modelService, languageService, resource, FileKind.FILE);
openable = { fileUri: resource };
fullLabel = recent.label || labelService.getUriLabel(resource);
}

View file

@ -16,7 +16,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
import { IQuickInputService, IPickOptions, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
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 { IFileDialogService, IPickAndOpenOptions } from 'vs/platform/dialogs/common/dialogs';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
@ -86,7 +86,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, async functio
const labelService = accessor.get(ILabelService);
const contextService = accessor.get(IWorkspaceContextService);
const modelService = accessor.get(IModelService);
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
const folders = contextService.getWorkspace().folders;
if (!folders.length) {
@ -98,7 +98,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, async functio
label: folder.name,
description: labelService.getUriLabel(dirname(folder.uri), { relative: true }),
folder,
iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER)
iconClasses: getIconClasses(modelService, languageService, folder.uri, FileKind.ROOT_FOLDER)
};
});

View file

@ -6,7 +6,7 @@
import { URI } from 'vs/base/common/uri';
import { dirname, isEqual, basenameOrAuthority } from 'vs/base/common/resources';
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IModelService } from 'vs/editor/common/services/modelService';
@ -114,7 +114,7 @@ export class ResourceLabels extends Disposable {
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IDecorationsService private readonly decorationsService: IDecorationsService,
@IThemeService private readonly themeService: IThemeService,
@ILabelService private readonly labelService: ILabelService,
@ -133,7 +133,7 @@ export class ResourceLabels extends Disposable {
}));
// notify when extensions are registered with potentially new languages
this._register(this.modeService.onLanguagesMaybeChanged(() => this.widgets.forEach(widget => widget.notifyExtensionsRegistered())));
this._register(this.languageService.onLanguagesMaybeChanged(() => this.widgets.forEach(widget => widget.notifyExtensionsRegistered())));
// notify when model mode changes
this._register(this.modelService.onModelModeChanged(e => {
@ -250,13 +250,13 @@ export class ResourceLabel extends ResourceLabels {
@IInstantiationService instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IDecorationsService decorationsService: IDecorationsService,
@IThemeService themeService: IThemeService,
@ILabelService labelService: ILabelService,
@ITextFileService textFileService: ITextFileService
) {
super(DEFAULT_LABELS_CONTAINER, instantiationService, configurationService, modelService, modeService, decorationsService, themeService, labelService, textFileService);
super(DEFAULT_LABELS_CONTAINER, instantiationService, configurationService, modelService, languageService, decorationsService, themeService, labelService, textFileService);
this.label = this._register(this.create(container, options));
}
@ -285,7 +285,7 @@ class ResourceLabelWidget extends IconLabel {
constructor(
container: HTMLElement,
options: IIconLabelCreationOptions | undefined,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IModelService private readonly modelService: IModelService,
@IDecorationsService private readonly decorationsService: IDecorationsService,
@ILabelService private readonly labelService: ILabelService,
@ -535,7 +535,7 @@ class ResourceLabelWidget extends IconLabel {
if (this.options && !this.options.hideIcon) {
if (!this.computedIconClasses) {
this.computedIconClasses = getIconClasses(this.modelService, this.modeService, resource, this.options.fileKind);
this.computedIconClasses = getIconClasses(this.modelService, this.languageService, resource, this.options.fileKind);
}
iconLabelOptions.extraClasses = this.computedIconClasses.slice(0);

View file

@ -11,7 +11,7 @@ import { IEditorGroupsService, GroupsOrder } from 'vs/workbench/services/editor/
import { EditorsOrder, IEditorIdentifier, EditorResourceAccessor, SideBySideEditor, GroupIdentifier } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
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 { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { prepareQuery, scoreItemFuzzy, compareItemsByFuzzyScore, FuzzyScorerCache } from 'vs/base/common/fuzzyScorer';
import { CancellationToken } from 'vs/base/common/cancellation';
@ -46,7 +46,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
@IEditorGroupsService protected readonly editorGroupService: IEditorGroupsService,
@IEditorService protected readonly editorService: IEditorService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService
@ILanguageService private readonly languageService: ILanguageService
) {
super(prefix,
{
@ -156,7 +156,7 @@ export abstract class BaseEditorQuickAccessProvider extends PickerQuickAccessPro
return isDirty ? localize('entryAriaLabelDirty', "{0}, unsaved changes", nameAndDescription) : nameAndDescription;
})(),
description,
iconClasses: getIconClasses(this.modelService, this.modeService, resource).concat(editor.getLabelExtraClasses()),
iconClasses: getIconClasses(this.modelService, this.languageService, resource).concat(editor.getLabelExtraClasses()),
italic: !this.editorGroupService.getGroup(groupId)?.isPinned(editor),
buttons: (() => {
return [
@ -197,9 +197,9 @@ export class ActiveGroupEditorsByMostRecentlyUsedQuickAccess extends BaseEditorQ
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX, editorGroupService, editorService, modelService, modeService);
super(ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX, editorGroupService, editorService, modelService, languageService);
}
protected doGetEditors(): IEditorIdentifier[] {
@ -222,9 +222,9 @@ export class AllEditorsByAppearanceQuickAccess extends BaseEditorQuickAccessProv
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(AllEditorsByAppearanceQuickAccess.PREFIX, editorGroupService, editorService, modelService, modeService);
super(AllEditorsByAppearanceQuickAccess.PREFIX, editorGroupService, editorService, modelService, languageService);
}
protected doGetEditors(): IEditorIdentifier[] {
@ -253,9 +253,9 @@ export class AllEditorsByMostRecentlyUsedQuickAccess extends BaseEditorQuickAcce
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IEditorService editorService: IEditorService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService
@ILanguageService languageService: ILanguageService
) {
super(AllEditorsByMostRecentlyUsedQuickAccess.PREFIX, editorGroupService, editorService, modelService, modeService);
super(AllEditorsByMostRecentlyUsedQuickAccess.PREFIX, editorGroupService, editorService, modelService, languageService);
}
protected doGetEditors(): IEditorIdentifier[] {

View file

@ -25,7 +25,7 @@ import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/bina
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IFileService, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IModeService, ILanguageSelection } from 'vs/editor/common/services/modeService';
import { ILanguageService, ILanguageSelection } from 'vs/editor/common/services/languageService';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { TabFocus } from 'vs/editor/common/config/commonEditorConfig';
@ -318,7 +318,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
constructor(
@IEditorService private readonly editorService: IEditorService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@ITextFileService private readonly textFileService: ITextFileService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@INotificationService private readonly notificationService: INotificationService,
@ -739,7 +739,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
const textModel = editorWidget.getModel();
if (textModel) {
const languageId = textModel.getLanguageId();
info.mode = withNullAsUndefined(this.modeService.getLanguageName(languageId));
info.mode = withNullAsUndefined(this.languageService.getLanguageName(languageId));
}
}
@ -1080,7 +1080,7 @@ export class ChangeModeAction extends Action {
constructor(
actionId: string,
actionLabel: string,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IEditorService private readonly editorService: IEditorService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@ -1108,7 +1108,7 @@ export class ChangeModeAction extends Action {
let currentModeId: string | undefined;
if (textModel) {
currentModeId = textModel.getLanguageId();
currentLanguageId = withNullAsUndefined(this.modeService.getLanguageName(currentModeId));
currentLanguageId = withNullAsUndefined(this.languageService.getLanguageName(currentModeId));
}
let hasLanguageSupport = !!resource;
@ -1117,11 +1117,11 @@ export class ChangeModeAction extends Action {
}
// All languages are valid picks
const languages = this.modeService.getRegisteredLanguageNames();
const languages = this.languageService.getRegisteredLanguageNames();
const picks: QuickPickInput[] = languages.sort()
.map(lang => {
const languageId = this.modeService.getModeIdForLanguageName(lang.toLowerCase()) || 'unknown';
const extensions = this.modeService.getExtensions(lang).join(' ');
const languageId = this.languageService.getModeIdForLanguageName(lang.toLowerCase()) || 'unknown';
const extensions = this.languageService.getExtensions(lang).join(' ');
let description: string;
if (currentLanguageId === lang) {
description = localize('languageDescription', "({0}) - Configured Language", languageId);
@ -1201,23 +1201,23 @@ export class ChangeModeAction extends Action {
const resource = EditorResourceAccessor.getOriginalUri(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
if (resource) {
// Detect languages since we are in an untitled file
let languageId: string | undefined = withNullAsUndefined(this.modeService.getModeIdByFilepathOrFirstLine(resource, textModel.getLineContent(1)));
let languageId: string | undefined = withNullAsUndefined(this.languageService.getModeIdByFilepathOrFirstLine(resource, textModel.getLineContent(1)));
if (!languageId) {
detectedLanguage = await this.languageDetectionService.detectLanguage(resource);
languageId = detectedLanguage;
}
if (languageId) {
languageSelection = this.modeService.create(languageId);
languageSelection = this.languageService.create(languageId);
}
}
}
} else {
languageSelection = this.modeService.createByLanguageName(pick.label);
languageSelection = this.languageService.createByLanguageName(pick.label);
if (resource) {
// fire and forget to not slow things down
this.languageDetectionService.detectLanguage(resource).then(detectedModeId => {
const chosenModeId = this.modeService.getModeIdForLanguageName(pick.label.toLowerCase()) || 'unknown';
const chosenModeId = this.languageService.getModeIdForLanguageName(pick.label.toLowerCase()) || 'unknown';
if (detectedModeId === currentModeId && currentModeId !== chosenModeId) {
// If they didn't choose the detected language (which should also be the active language if automatic detection is enabled)
// then the automatic language detection was likely wrong and the user is correcting it. In this case, we want telemetry.
@ -1247,11 +1247,11 @@ export class ChangeModeAction extends Action {
private configureFileAssociation(resource: URI): void {
const extension = extname(resource);
const base = basename(resource);
const currentAssociation = this.modeService.getModeIdByFilepathOrFirstLine(URI.file(base));
const currentAssociation = this.languageService.getModeIdByFilepathOrFirstLine(URI.file(base));
const languages = this.modeService.getRegisteredLanguageNames();
const languages = this.languageService.getRegisteredLanguageNames();
const picks: IQuickPickItem[] = languages.sort().map((lang, index) => {
const id = withNullAsUndefined(this.modeService.getModeIdForLanguageName(lang.toLowerCase())) || 'unknown';
const id = withNullAsUndefined(this.languageService.getModeIdForLanguageName(lang.toLowerCase())) || 'unknown';
return {
id,

View file

@ -23,7 +23,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
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 { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { EditorOption, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/config/editorOptions';
import { ModelConstants } from 'vs/editor/common/model';
@ -145,7 +145,7 @@ export class TextResourceEditor extends AbstractTextResourceEditor {
@IEditorService editorService: IEditorService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService
@ILanguageService private readonly languageService: ILanguageService
) {
super(TextResourceEditor.ID, telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorGroupService, editorService);
}
@ -198,12 +198,12 @@ export class TextResourceEditor extends AbstractTextResourceEditor {
// We can still try to guess a good mode from the first line if
// the paste changed the first line
else {
candidateMode = withNullAsUndefined(this.modeService.getModeIdByFilepathOrFirstLine(textModel.uri, textModel.getLineContent(1).substr(0, ModelConstants.FIRST_LINE_DETECTION_LENGTH_LIMIT)));
candidateMode = withNullAsUndefined(this.languageService.getModeIdByFilepathOrFirstLine(textModel.uri, textModel.getLineContent(1).substr(0, ModelConstants.FIRST_LINE_DETECTION_LENGTH_LIMIT)));
}
// Finally apply mode to model if specified
if (candidateMode !== PLAINTEXT_MODE_ID) {
this.modelService.setMode(textModel, this.modeService.create(candidateMode));
this.modelService.setMode(textModel, this.languageService.create(candidateMode));
}
}
}

View file

@ -8,7 +8,7 @@ import { EditorModel } from 'vs/workbench/common/editor/editorModel';
import { IModeSupport } from 'vs/workbench/services/textfile/common/textfiles';
import { URI } from 'vs/base/common/uri';
import { ITextEditorModel, IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
import { IModeService, ILanguageSelection } from 'vs/editor/common/services/modeService';
import { ILanguageService, ILanguageSelection } from 'vs/editor/common/services/languageService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { MutableDisposable } from 'vs/base/common/lifecycle';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
@ -34,7 +34,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
constructor(
@IModelService protected modelService: IModelService,
@IModeService protected modeService: IModeService,
@ILanguageService protected languageService: ILanguageService,
@ILanguageDetectionService private readonly languageDetectionService: ILanguageDetectionService,
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
textEditorModelHandle?: URI
@ -95,7 +95,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
return;
}
this.modelService.setMode(this.textEditorModel, this.modeService.create(mode));
this.modelService.setMode(this.textEditorModel, this.languageService.create(mode));
}
getMode(): string | undefined {
@ -118,7 +118,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
const lang = await this.languageDetectionService.detectLanguage(this.textEditorModelHandle);
if (lang && !this.isDisposed()) {
this.setModeInternal(lang);
const languageName = this.modeService.getLanguageName(lang);
const languageName = this.languageService.getLanguageName(lang);
if (languageName) {
this.accessibilityService.alert(localize('languageAutoDetected', "Language {0} was automatically detected and set as the language mode.", languageName));
}
@ -131,7 +131,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
*/
protected createTextEditorModel(value: ITextBufferFactory, resource: URI | undefined, preferredMode?: string): ITextModel {
const firstLineText = this.getFirstLineText(value);
const languageSelection = this.getOrCreateMode(resource, this.modeService, preferredMode, firstLineText);
const languageSelection = this.getOrCreateMode(resource, this.languageService, preferredMode, firstLineText);
return this.doCreateTextEditorModel(value, languageSelection, resource);
}
@ -171,15 +171,15 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
*
* @param firstLineText optional first line of the text buffer to set the mode on. This can be used to guess a mode from content.
*/
protected getOrCreateMode(resource: URI | undefined, modeService: IModeService, preferredMode: string | undefined, firstLineText?: string): ILanguageSelection {
protected getOrCreateMode(resource: URI | undefined, languageService: ILanguageService, preferredMode: string | undefined, firstLineText?: string): ILanguageSelection {
// lookup mode via resource path if the provided mode is unspecific
if (!preferredMode || preferredMode === PLAINTEXT_MODE_ID) {
return modeService.createByFilepathOrFirstLine(withUndefinedAsNull(resource), firstLineText);
return languageService.createByFilepathOrFirstLine(withUndefinedAsNull(resource), firstLineText);
}
// otherwise take the preferred mode for granted
return modeService.create(preferredMode);
return languageService.create(preferredMode);
}
/**
@ -197,7 +197,7 @@ export class BaseTextEditorModel extends EditorModel implements ITextEditorModel
// mode (only if specific and changed)
if (preferredMode && preferredMode !== PLAINTEXT_MODE_ID && this.textEditorModel.getLanguageId() !== preferredMode) {
this.modelService.setMode(this.textEditorModel, this.modeService.create(preferredMode));
this.modelService.setMode(this.textEditorModel, this.languageService.create(preferredMode));
}
}

View file

@ -5,7 +5,7 @@
import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel';
import { URI } 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 { ILanguageDetectionService } from 'vs/workbench/services/languageDetection/common/languageDetectionWorkerService';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
@ -18,12 +18,12 @@ export class TextResourceEditorModel extends BaseTextEditorModel {
constructor(
resource: URI,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IModelService modelService: IModelService,
@ILanguageDetectionService languageDetectionService: ILanguageDetectionService,
@IAccessibilityService accessibilityService: IAccessibilityService,
) {
super(modelService, modeService, languageDetectionService, accessibilityService, resource);
super(modelService, languageService, languageDetectionService, accessibilityService, resource);
}
override dispose(): void {

View file

@ -9,7 +9,7 @@ import { deepClone, equals } from 'vs/base/common/objects';
import { Emitter } from 'vs/base/common/event';
import { basename, dirname, extname, relativePath, isEqual } from 'vs/base/common/resources';
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IFileService } from 'vs/platform/files/common/files';
import { DisposableStore, Disposable } from 'vs/base/common/lifecycle';
import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob';
@ -48,7 +48,7 @@ export class ResourceContextKey implements IContextKey<URI> {
constructor(
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
@IFileService private readonly _fileService: IFileService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IModelService private readonly _modelService: IModelService,
) {
this._schemeKey = ResourceContextKey.Scheme.bindTo(this._contextKeyService);
@ -66,7 +66,7 @@ export class ResourceContextKey implements IContextKey<URI> {
this._isFileSystemResource.set(Boolean(resource && _fileService.hasProvider(resource)));
}));
this._disposables.add(_modeService.onDidEncounterLanguage(this._setLangId, this));
this._disposables.add(_languageService.onDidEncounterLanguage(this._setLangId, this));
this._disposables.add(_modelService.onModelAdded(model => {
if (isEqual(model.uri, this.get())) {
this._setLangId();
@ -89,7 +89,7 @@ export class ResourceContextKey implements IContextKey<URI> {
this._langIdKey.set(null);
return;
}
const langId = this._modelService.getModel(value)?.getLanguageId() ?? this._modeService.getModeIdByFilepathOrFirstLine(value);
const langId = this._modelService.getModel(value)?.getLanguageId() ?? this._languageService.getModeIdByFilepathOrFirstLine(value);
this._langIdKey.set(langId);
}

View file

@ -5,7 +5,7 @@
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import { URI } 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 { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel';
import { WorkspaceEditMetadata } from 'vs/editor/common/modes';
@ -366,7 +366,7 @@ export class BulkEditPreviewProvider implements ITextModelContentProvider {
constructor(
private readonly _operations: BulkFileOperations,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IModelService private readonly _modelService: IModelService,
@ITextModelService private readonly _textModelResolverService: ITextModelService
) {
@ -416,7 +416,7 @@ export class BulkEditPreviewProvider implements ITextModelContentProvider {
const sourceModel = ref.object.textEditorModel;
model = this._modelService.createModel(
createTextBufferFactoryFromSnapshot(sourceModel.createSnapshot()),
this._modeService.create(sourceModel.getLanguageId()),
this._languageService.create(sourceModel.getLanguageId()),
previewUri
);
ref.dispose();
@ -425,7 +425,7 @@ export class BulkEditPreviewProvider implements ITextModelContentProvider {
// create NEW model
model = this._modelService.createModel(
'',
this._modeService.createByFilepathOrFirstLine(previewUri),
this._languageService.createByFilepathOrFirstLine(previewUri),
previewUri
);
}

View file

@ -28,7 +28,7 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { Iterable } from 'vs/base/common/iterator';
import { ResourceFileEdit } from 'vs/editor/browser/services/bulkEditService';
import { ILanguageConfigurationService } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
// --- VIEW MODEL
@ -180,7 +180,7 @@ export class BulkEditDataSource implements IAsyncDataSource<BulkFileOperations,
constructor(
@ITextModelService private readonly _textModelService: ITextModelService,
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,
) { }
@ -218,7 +218,7 @@ export class BulkEditDataSource implements IAsyncDataSource<BulkFileOperations,
textModel = ref.object.textEditorModel;
textModelDisposable = ref;
} catch {
textModel = new TextModel('', TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService, this._modeService, this._languageConfigurationService);
textModel = new TextModel('', TextModel.DEFAULT_CREATION_OPTIONS, null, null, this._undoRedoService, this._languageService, this._languageConfigurationService);
textModelDisposable = textModel;
}

View file

@ -17,7 +17,7 @@ import { Range } from 'vs/editor/common/core/range';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { FontStyle, StandardTokenType, TokenMetadata, DocumentSemanticTokensProviderRegistry, SemanticTokensLegend, SemanticTokens, ColorId, DocumentRangeSemanticTokensProviderRegistry } from 'vs/editor/common/modes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { editorHoverBackground, editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@ -46,7 +46,7 @@ class InspectEditorTokensController extends Disposable implements IEditorContrib
private _editor: ICodeEditor;
private _textMateService: ITextMateService;
private _themeService: IWorkbenchThemeService;
private _modeService: IModeService;
private _languageService: ILanguageService;
private _notificationService: INotificationService;
private _configurationService: IConfigurationService;
private _widget: InspectEditorTokensWidget | null;
@ -54,7 +54,7 @@ class InspectEditorTokensController extends Disposable implements IEditorContrib
constructor(
editor: ICodeEditor,
@ITextMateService textMateService: ITextMateService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@INotificationService notificationService: INotificationService,
@IConfigurationService configurationService: IConfigurationService
@ -63,7 +63,7 @@ class InspectEditorTokensController extends Disposable implements IEditorContrib
this._editor = editor;
this._textMateService = textMateService;
this._themeService = themeService;
this._modeService = modeService;
this._languageService = languageService;
this._notificationService = notificationService;
this._configurationService = configurationService;
this._widget = null;
@ -89,7 +89,7 @@ class InspectEditorTokensController extends Disposable implements IEditorContrib
// disable in notebooks
return;
}
this._widget = new InspectEditorTokensWidget(this._editor, this._textMateService, this._modeService, this._themeService, this._notificationService, this._configurationService);
this._widget = new InspectEditorTokensWidget(this._editor, this._textMateService, this._languageService, this._themeService, this._notificationService, this._configurationService);
}
public stop(): void {
@ -184,7 +184,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
private _isDisposed: boolean;
private readonly _editor: IActiveCodeEditor;
private readonly _modeService: IModeService;
private readonly _languageService: ILanguageService;
private readonly _themeService: IWorkbenchThemeService;
private readonly _textMateService: ITextMateService;
private readonly _notificationService: INotificationService;
@ -196,7 +196,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
constructor(
editor: IActiveCodeEditor,
textMateService: ITextMateService,
modeService: IModeService,
languageService: ILanguageService,
themeService: IWorkbenchThemeService,
notificationService: INotificationService,
configurationService: IConfigurationService
@ -204,7 +204,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
super();
this._isDisposed = false;
this._editor = editor;
this._modeService = modeService;
this._languageService = languageService;
this._themeService = themeService;
this._textMateService = textMateService;
this._notificationService = notificationService;
@ -455,7 +455,7 @@ class InspectEditorTokensWidget extends Disposable implements IContentWidget {
let foreground = TokenMetadata.getForeground(metadata);
let background = TokenMetadata.getBackground(metadata);
return {
languageId: this._modeService.languageIdCodec.decodeLanguageId(languageId),
languageId: this._languageService.languageIdCodec.decodeLanguageId(languageId),
tokenType: tokenType,
bold: (fontStyle & FontStyle.Bold) ? true : undefined,
italic: (fontStyle & FontStyle.Italic) ? true : undefined,

View file

@ -10,7 +10,7 @@ import * as types from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { CharacterPair, CommentRule, EnterAction, ExplicitLanguageConfiguration, FoldingRules, IAutoClosingPair, IAutoClosingPairConditional, IndentAction, IndentationRule, OnEnterRule } from 'vs/editor/common/modes/languageConfiguration';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
@ -82,14 +82,14 @@ export class LanguageConfigurationFileHandler {
constructor(
@ITextMateService textMateService: ITextMateService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@IExtensionResourceLoaderService private readonly _extensionResourceLoaderService: IExtensionResourceLoaderService,
@IExtensionService private readonly _extensionService: IExtensionService
) {
this._done = new Set<string>();
// Listen for hints that a language configuration is needed/usefull and then load it once
this._modeService.onDidEncounterLanguage((languageIdentifier) => {
this._languageService.onDidEncounterLanguage((languageIdentifier) => {
// Modes can be instantiated before the extension points have finished registering
this._extensionService.whenInstalledExtensionsRegistered().then(() => {
this._loadConfigurationsForMode(languageIdentifier);
@ -106,7 +106,7 @@ export class LanguageConfigurationFileHandler {
}
this._done.add(languageId);
const configurationFiles = this._modeService.getConfigurationFiles(languageId);
const configurationFiles = this._languageService.getConfigurationFiles(languageId);
configurationFiles.forEach((configFileLocation) => this._handleConfigFile(languageId, configFileLocation));
}

View file

@ -12,7 +12,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { ITextModel } from 'vs/editor/common/model';
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 { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@ -80,7 +80,7 @@ export class CommentNode extends Disposable {
@IInstantiationService private instantiationService: IInstantiationService,
@ICommentService private commentService: ICommentService,
@IModelService private modelService: IModelService,
@IModeService private modeService: IModeService,
@ILanguageService private languageService: ILanguageService,
@INotificationService private notificationService: INotificationService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IContextKeyService contextKeyService: IContextKeyService
@ -334,7 +334,7 @@ export class CommentNode extends Disposable {
const container = dom.append(editContainer, dom.$('.edit-textarea'));
this._commentEditor = this.instantiationService.createInstance(SimpleCommentEditor, container, SimpleCommentEditor.getEditorOptions(), this.parentEditor, this.parentThread);
const resource = URI.parse(`comment:commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`);
this._commentEditorModel = this.modelService.createModel('', this.modeService.createByFilepathOrFirstLine(resource), resource, false);
this._commentEditorModel = this.modelService.createModel('', this.languageService.createByFilepathOrFirstLine(resource), resource, false);
this._commentEditor.setModel(this._commentEditorModel);
this._commentEditor.setValue(this.comment.body.value);

View file

@ -20,7 +20,7 @@ import { IRange, Range } from 'vs/editor/common/core/range';
import { ITextModel } from 'vs/editor/common/model';
import * as modes from 'vs/editor/common/modes';
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 { MarkdownRenderer } from 'vs/editor/browser/core/markdownRenderer';
import { peekViewBorder } from 'vs/editor/contrib/peekView/peekView';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/zoneWidget';
@ -161,7 +161,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
private _commentThread: modes.CommentThread,
private _pendingComment: string | null,
@IInstantiationService private instantiationService: IInstantiationService,
@IModeService private modeService: IModeService,
@ILanguageService private languageService: ILanguageService,
@IModelService private modelService: IModelService,
@IThemeService private themeService: IThemeService,
@ICommentService private commentService: ICommentService,
@ -205,7 +205,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
}));
this._applyTheme(this.themeService.getColorTheme());
this._markdownRenderer = this._globalToDispose.add(new MarkdownRenderer({ editor }, this.modeService, this.openerService));
this._markdownRenderer = this._globalToDispose.add(new MarkdownRenderer({ editor }, this.languageService, this.openerService));
this._parentEditor = editor;
}
@ -562,7 +562,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
resource = resource.with({ authority: commentController.id });
}
const model = this.modelService.createModel(this._pendingComment || '', this.modeService.createByFilepathOrFirstLine(resource), resource, false);
const model = this.modelService.createModel(this._pendingComment || '', this.languageService.createByFilepathOrFirstLine(resource), resource, false);
this._disposables.add(model);
commentEditor.setModel(model);
this._disposables.add(commentEditor);

View file

@ -11,7 +11,7 @@ import * as strings from 'vs/base/common/strings';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorModel } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import * as nls from 'vs/nls';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -53,7 +53,7 @@ export class AdapterManager extends Disposable implements IAdapterManager {
@ICommandService private readonly commandService: ICommandService,
@IExtensionService private readonly extensionService: IExtensionService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IDialogService private readonly dialogService: IDialogService,
@ILifecycleService private readonly lifecycleService: ILifecycleService,
) {
@ -308,7 +308,7 @@ export class AdapterManager extends Disposable implements IAdapterManager {
model = activeTextEditorControl.getModel();
const language = model ? model.getLanguageId() : undefined;
if (language) {
languageLabel = this.modeService.getLanguageName(language);
languageLabel = this.languageService.getLanguageName(language);
}
const adapters = this.debuggers
.filter(a => a.enabled)

View file

@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
import { guessMimeTypes, Mimes } from 'vs/base/common/mime';
import { ITextModel } from 'vs/editor/common/model';
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, ITextModelContentProvider } from 'vs/editor/common/services/resolverService';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { DEBUG_SCHEME, IDebugService, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
@ -41,7 +41,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
@ITextModelService textModelResolverService: ITextModelService,
@IDebugService private readonly debugService: IDebugService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IEditorWorkerService private readonly editorWorkerService: IEditorWorkerService
) {
textModelResolverService.registerTextModelContentProvider(DEBUG_SCHEME, this);
@ -94,7 +94,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
}
const createErrModel = (errMsg?: string) => {
this.debugService.sourceIsNotAvailable(resource);
const languageSelection = this.modeService.create(Mimes.text);
const languageSelection = this.languageService.create(Mimes.text);
const message = errMsg
? localize('canNotResolveSourceWithError', "Could not load source '{0}': {1}.", resource.path, errMsg)
: localize('canNotResolveSource', "Could not load source '{0}'.", resource.path);
@ -134,7 +134,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC
} else {
// create text model
const mime = response.body.mimeType || guessMimeTypes(resource)[0];
const languageSelection = this.modeService.create(mime);
const languageSelection = this.languageService.create(mime);
return this.modelService.createModel(response.body.content, languageSelection, resource);
}
}

View file

@ -57,7 +57,7 @@ import { platform } from 'vs/base/common/process';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import { DEFAULT_MARKDOWN_STYLES, renderMarkdownDocument } from 'vs/workbench/contrib/markdown/browser/markdownDocumentRenderer';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization';
import { buttonForeground, buttonHoverBackground, editorBackground, textLinkActiveForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
@ -211,7 +211,7 @@ export class ExtensionEditor extends EditorPane {
@IExtensionService private readonly extensionService: IExtensionService,
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
@IWebviewService private readonly webviewService: IWebviewService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
) {
@ -786,7 +786,7 @@ export class ExtensionEditor extends EditorPane {
private async renderMarkdown(cacheResult: CacheResult<string>, container: HTMLElement) {
const contents = await this.loadContents(() => cacheResult, container);
const content = await renderMarkdownDocument(contents, this.extensionService, this.modeService);
const content = await renderMarkdownDocument(contents, this.extensionService, this.languageService);
return this.renderBody(content);
}

View file

@ -34,7 +34,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IFileService } from 'vs/platform/files/common/files';
import { IExtensionManifest, ExtensionType, IExtension as IPlatformExtension } from 'vs/platform/extensions/common/extensions';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IProductService } from 'vs/platform/product/common/productService';
import { FileAccess } from 'vs/base/common/network';
import { IIgnoredExtensionsManagementService } from 'vs/platform/userDataSync/common/ignoredExtensions';
@ -637,7 +637,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
@IProgressService private readonly progressService: IProgressService,
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
@IStorageService private readonly storageService: IStorageService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IIgnoredExtensionsManagementService private readonly extensionsSyncManagementService: IIgnoredExtensionsManagementService,
@IUserDataAutoSyncService private readonly userDataAutoSyncService: IUserDataAutoSyncService,
@IProductService private readonly productService: IProductService,
@ -805,8 +805,8 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
const keywords = lookup[ext] || [];
// Get mode name
const languageId = this.modeService.getModeIdByFilepathOrFirstLine(URI.file(`.${ext}`));
const languageName = languageId && this.modeService.getLanguageName(languageId);
const languageId = this.languageService.getModeIdByFilepathOrFirstLine(URI.file(`.${ext}`));
const languageName = languageId && this.languageService.getLanguageName(languageId);
const languageTag = languageName ? ` tag:"${languageName}"` : '';
// Construct a rich query

View file

@ -23,7 +23,7 @@ import { URI } from 'vs/base/common/uri';
import { Mimes, guessMimeTypes } from 'vs/base/common/mime';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
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 { IExtensionRecommendationNotificationService, RecommendationsNotificationResult, RecommendationSource } from 'vs/platform/extensionRecommendations/common/extensionRecommendations';
import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService';
import { distinct } from 'vs/base/common/arrays';
@ -95,7 +95,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
@IExtensionService private readonly extensionService: IExtensionService,
@IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IProductService productService: IProductService,
@INotificationService private readonly notificationService: INotificationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@ -197,7 +197,7 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
private async promptRecommendations(uri: URI, language: string, fileExtension: string): Promise<void> {
const importantRecommendations: string[] = (this.fileBasedRecommendationsByLanguage.get(language) || []).filter(extensionId => this.importantExtensionTips.has(extensionId));
let languageName: string | null = importantRecommendations.length ? this.modeService.getLanguageName(language) : null;
let languageName: string | null = importantRecommendations.length ? this.languageService.getLanguageName(language) : null;
const fileBasedRecommendations: string[] = [...importantRecommendations];
for (let [pattern, extensionIds] of this.fileBasedRecommendationsByPattern) {

View file

@ -23,7 +23,7 @@ import { REVEAL_IN_EXPLORER_COMMAND_ID, SAVE_ALL_IN_GROUP_COMMAND_ID, NEW_UNTITL
import { ITextModelService, ITextModelContentProvider } from 'vs/editor/common/services/resolverService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
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 { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
@ -753,13 +753,13 @@ export class CompareWithClipboardAction extends Action {
class ClipboardContentProvider implements ITextModelContentProvider {
constructor(
@IClipboardService private readonly clipboardService: IClipboardService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IModelService private readonly modelService: IModelService
) { }
async provideTextContent(resource: URI): Promise<ITextModel> {
const text = await this.clipboardService.readText();
const model = this.modelService.createModel(text, this.modeService.createByFilepathOrFirstLine(resource), resource);
const model = this.modelService.createModel(text, this.languageService.createByFilepathOrFirstLine(resource), resource);
return model;
}

View file

@ -13,7 +13,7 @@ import { ITextModelContentProvider } from 'vs/editor/common/services/resolverSer
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { ITextModel } from 'vs/editor/common/model';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService, ILanguageSelection } from 'vs/editor/common/services/modeService';
import { ILanguageService, ILanguageSelection } from 'vs/editor/common/services/languageService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
@ -131,7 +131,7 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
constructor(
@ITextFileService private readonly textFileService: ITextFileService,
@IFileService private readonly fileService: IFileService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IModelService private readonly modelService: IModelService
) {
super();
@ -198,9 +198,9 @@ export class TextFileContentProvider extends Disposable implements ITextModelCon
let languageSelector: ILanguageSelection;
if (textFileModel) {
languageSelector = this.modeService.create(textFileModel.getLanguageId());
languageSelector = this.languageService.create(textFileModel.getLanguageId());
} else {
languageSelector = this.modeService.createByFilepathOrFirstLine(savedFileResource);
languageSelector = this.languageService.createByFilepathOrFirstLine(savedFileResource);
}
codeEditorModel = this.modelService.createModel(content.value, languageSelector, resource);

View file

@ -25,7 +25,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ITextModel } from 'vs/editor/common/model';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { editorConfigurationBaseNode } from 'vs/editor/common/config/commonEditorConfig';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
@ -47,7 +47,7 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
@INotificationService private readonly _notificationService: INotificationService,
@IDialogService private readonly _dialogService: IDialogService,
@IQuickInputService private readonly _quickInputService: IQuickInputService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
) {
super();
this._register(this._extensionService.onDidChangeExtensions(this._updateConfigValues, this));
@ -111,7 +111,7 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
const extension = await this._extensionService.getExtension(defaultFormatterId);
if (extension && this._extensionEnablementService.isEnabled(toExtension(extension))) {
// formatter does not target this file
const langName = this._modeService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const langName = this._languageService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const detail = nls.localize('miss', "Extension '{0}' is configured as formatter but it cannot format '{1}'-files", extension.displayName || extension.name, langName);
if (mode === FormattingMode.Silent) {
this._notificationService.status(detail, { hideAfter: 4000 });
@ -135,7 +135,7 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
return formatter[0];
}
const langName = this._modeService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const langName = this._languageService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const message = !defaultFormatterId
? nls.localize('config.needed', "There are multiple formatters for '{0}' files. Select a default formatter to continue.", DefaultFormatter._maybeQuotes(langName))
: nls.localize('config.bad', "Extension '{0}' is configured as formatter but not available. Select a different default formatter to continue.", defaultFormatterId);
@ -172,7 +172,7 @@ class DefaultFormatter extends Disposable implements IWorkbenchContribution {
description: formatter.extensionId && formatter.extensionId.value
};
});
const langName = this._modeService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const langName = this._languageService.getLanguageName(document.getLanguageId()) || document.getLanguageId();
const pick = await this._quickInputService.pick(picks, { placeHolder: nls.localize('select', "Select a default formatter for '{0}' files", DefaultFormatter._maybeQuotes(langName)) });
if (!pick || !formatter[pick.index].extensionId) {
return undefined;
@ -231,7 +231,7 @@ function logFormatterTelemetry<T extends { extensionId?: ExtensionIdentifier }>(
async function showFormatterPick(accessor: ServicesAccessor, model: ITextModel, formatters: FormattingEditProvider[]): Promise<number | undefined> {
const quickPickService = accessor.get(IQuickInputService);
const configService = accessor.get(IConfigurationService);
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
const overrides = { resource: model.uri, overrideIdentifier: model.getLanguageId() };
const defaultFormatter = configService.getValue<string>(DefaultFormatter.configName, overrides);
@ -270,7 +270,7 @@ async function showFormatterPick(accessor: ServicesAccessor, model: ITextModel,
} else if (pick === configurePick) {
// config default
const langName = modeService.getLanguageName(model.getLanguageId()) || model.getLanguageId();
const langName = languageService.getLanguageName(model.getLanguageId()) || model.getLanguageId();
const pick = await quickPickService.pick(picks, { placeHolder: nls.localize('select', "Select a default formatter for '{0}' files", DefaultFormatter._maybeQuotes(langName)) });
if (pick && formatters[pick.index].extensionId) {
configService.updateValue(DefaultFormatter.configName, formatters[pick.index].extensionId!.value, overrides);

View file

@ -30,7 +30,7 @@ import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsSe
import { ExecutionStateCellStatusBarContrib, TimerCellStatusBarContrib } from 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController';
import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/notebookKernelService';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { INTERACTIVE_INPUT_CURSOR_BOUNDARY } from 'vs/workbench/contrib/interactive/browser/interactiveCommon';
@ -80,7 +80,7 @@ export class InteractiveEditor extends EditorPane {
// #inputLineCount = 1;
#notebookWidgetService: INotebookEditorService;
#instantiationService: IInstantiationService;
#modeService: IModeService;
#languageService: ILanguageService;
#contextKeyService: IContextKeyService;
#notebookKernelService: INotebookKernelService;
#keybindingService: IKeybindingService;
@ -103,7 +103,7 @@ export class InteractiveEditor extends EditorPane {
@IContextKeyService contextKeyService: IContextKeyService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@INotebookKernelService notebookKernelService: INotebookKernelService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IKeybindingService keybindingService: IKeybindingService,
@IInteractiveHistoryService historyService: IInteractiveHistoryService,
@IConfigurationService configurationService: IConfigurationService,
@ -120,7 +120,7 @@ export class InteractiveEditor extends EditorPane {
this.#notebookWidgetService = notebookWidgetService;
this.#contextKeyService = contextKeyService;
this.#notebookKernelService = notebookKernelService;
this.#modeService = modeService;
this.#languageService = languageService;
this.#keybindingService = keybindingService;
this.#historyService = historyService;
this.#menuService = menuService;
@ -513,7 +513,7 @@ export class InteractiveEditor extends EditorPane {
if (selectedOrSuggested) {
const language = selectedOrSuggested.supportedLanguages[0];
const newMode = language ? this.#modeService.create(language).languageId : PLAINTEXT_MODE_ID;
const newMode = language ? this.#languageService.create(language).languageId : PLAINTEXT_MODE_ID;
textModel.setMode(newMode);
}
}

View file

@ -8,7 +8,7 @@ import * as marked from 'vs/base/common/marked/marked';
import { Schemas } from 'vs/base/common/network';
import { ITokenizationSupport, TokenizationRegistry } from 'vs/editor/common/modes';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
export const DEFAULT_MARKDOWN_STYLES = `
@ -199,7 +199,7 @@ function sanitize(documentContent: string, allowUnknownProtocols: boolean): stri
export async function renderMarkdownDocument(
text: string,
extensionService: IExtensionService,
modeService: IModeService,
languageService: ILanguageService,
shouldSanitize: boolean = true,
allowUnknownProtocols: boolean = false,
): Promise<string> {
@ -210,12 +210,12 @@ export async function renderMarkdownDocument(
}
extensionService.whenInstalledExtensionsRegistered().then(async () => {
let support: ITokenizationSupport | undefined;
const languageId = modeService.getModeIdForLanguageName(lang);
const languageId = languageService.getModeIdForLanguageName(lang);
if (languageId) {
modeService.triggerMode(languageId);
languageService.triggerMode(languageId);
support = await TokenizationRegistry.getPromise(languageId) ?? undefined;
}
callback(null, `<code>${tokenizeToString(code, modeService.languageIdCodec, support)}</code>`);
callback(null, `<code>${tokenizeToString(code, languageService.languageIdCodec, support)}</code>`);
});
return '';
};

View file

@ -6,7 +6,7 @@
import { CancellationToken } from 'vs/base/common/cancellation';
import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { localize } from 'vs/nls';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/registry/common/platform';
@ -23,7 +23,7 @@ class CellStatusBarLanguagePickerProvider implements INotebookCellStatusBarItemP
constructor(
@INotebookService private readonly _notebookService: INotebookService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
) { }
async provideCellStatusBarItems(uri: URI, index: number, _token: CancellationToken): Promise<INotebookCellStatusBarItemList | undefined> {
@ -35,8 +35,8 @@ class CellStatusBarLanguagePickerProvider implements INotebookCellStatusBarItemP
const languageId = cell.cellKind === CellKind.Markup ?
'markdown' :
(this._modeService.getModeIdForLanguageName(cell.language) || cell.language);
const text = this._modeService.getLanguageName(languageId) || languageId;
(this._languageService.getModeIdForLanguageName(cell.language) || cell.language);
const text = this._languageService.getLanguageName(languageId) || languageId;
const item = <INotebookCellStatusBarItem>{
text,
command: CHANGE_CELL_LANGUAGE,

View file

@ -7,7 +7,7 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IEditorConstructionOptions } from 'vs/editor/browser/editorBrowser';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
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 { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { RenderOutputType, ICellOutputViewModel, IRenderOutput } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { OutputRendererRegistry } from 'vs/workbench/contrib/notebook/browser/view/output/rendererRegistry';
@ -29,7 +29,7 @@ abstract class CodeRendererContrib extends Disposable implements IOutputTransfor
public notebookEditor: INotebookDelegateForOutput,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
) {
super();
}
@ -60,7 +60,7 @@ abstract class CodeRendererContrib extends Disposable implements IOutputTransfor
container.style.height = `${editorHeight + 8}px`;
}));
const mode = this.modeService.create(languageId);
const mode = this.languageService.create(languageId);
const textModel = this.modelService.createModel(value, mode, undefined, false);
editor.setModel(textModel);
@ -81,7 +81,7 @@ abstract class CodeRendererContrib extends Disposable implements IOutputTransfor
export class NotebookCodeRendererContribution extends Disposable {
constructor(@IModeService _modeService: IModeService) {
constructor(@ILanguageService _languageService: ILanguageService) {
super();
const registeredMimeTypes = new Map();
@ -104,11 +104,11 @@ export class NotebookCodeRendererContribution extends Disposable {
registeredMimeTypes.set(mimeType, true);
};
_modeService.getRegisteredModes().forEach(id => {
_languageService.getRegisteredModes().forEach(id => {
registerCodeRendererContrib(`text/x-${id}`, id);
});
this._register(_modeService.onDidEncounterLanguage((languageId) => {
this._register(_languageService.onDidEncounterLanguage((languageId) => {
registerCodeRendererContrib(`text/x-${languageId}`, languageId);
}));

View file

@ -7,7 +7,7 @@ import * as assert from 'assert';
import { Range } from 'vs/editor/common/core/range';
import { ITextBuffer, ValidAnnotatedEditOperation } from 'vs/editor/common/model';
import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import { IConfigurationService, IConfigurationValue } from 'vs/platform/configuration/common/configuration';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
@ -73,7 +73,7 @@ suite('Notebook Find', () => {
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 3, count: 0, cells: [
new TestCell(viewModel.viewType, 3, '# next paragraph 1', 'markdown', CellKind.Code, [], accessor.get(IModeService)),
new TestCell(viewModel.viewType, 3, '# next paragraph 1', 'markdown', CellKind.Code, [], accessor.get(ILanguageService)),
]
}], true, undefined, () => undefined, undefined, true);
assert.strictEqual(editor.textModel.length, 4);

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { CellEditType, CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { TestCell, withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor';
@ -16,7 +16,7 @@ suite('Notebook Undo/Redo', () => {
['body', 'markdown', CellKind.Markup, [], {}],
],
async (editor, viewModel, accessor) => {
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
assert.strictEqual(viewModel.length, 2);
assert.strictEqual(viewModel.getVersionId(), 0);
assert.strictEqual(viewModel.getAlternativeId(), '0_0,1;1,1');
@ -40,7 +40,7 @@ suite('Notebook Undo/Redo', () => {
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 0, cells: [
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], modeService),
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], languageService),
]
}], true, undefined, () => undefined, undefined, true);
assert.strictEqual(viewModel.getVersionId(), 4);
@ -60,7 +60,7 @@ suite('Notebook Undo/Redo', () => {
['body', 'markdown', CellKind.Markup, [], {}],
],
async (editor, viewModel, accessor) => {
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 2, cells: []
}], true, undefined, () => undefined, undefined, true);
@ -68,7 +68,7 @@ suite('Notebook Undo/Redo', () => {
assert.doesNotThrow(() => {
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 2, cells: [
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], modeService),
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], languageService),
]
}], true, undefined, () => undefined, undefined, true);
});
@ -101,14 +101,14 @@ suite('Notebook Undo/Redo', () => {
['body', 'markdown', CellKind.Markup, [], {}],
],
async (editor, viewModel, accessor) => {
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 2, cells: []
}], true, undefined, () => undefined, undefined, true);
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 2, cells: [
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], modeService),
new TestCell(viewModel.viewType, 3, '# header 2', 'markdown', CellKind.Code, [], languageService),
]
}], true, undefined, () => undefined, undefined, true);

View file

@ -7,7 +7,7 @@ import { IBulkEditService, ResourceEdit, ResourceTextEdit } from 'vs/editor/brow
import { IPosition, Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { EndOfLinePreference, IReadonlyTextBuffer } from 'vs/editor/common/model';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ResourceNotebookCellEdit } from 'vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
import { INotebookActionContext, INotebookCellActionContext } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
import { CellEditState, CellFocusMode, expandCellRangesWithHiddenCells, IActiveNotebookEditor, ICellViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
@ -574,7 +574,7 @@ export function computeCellLinesContents(cell: ICellViewModel, splitPoints: IPos
}
export function insertCell(
modeService: IModeService,
languageService: ILanguageService,
editor: IActiveNotebookEditor,
index: number,
type: CellKind,
@ -592,7 +592,7 @@ export function insertCell(
const nextIndex = ui ? viewModel.getNextVisibleCellIndex(index) : index + 1;
let language;
if (type === CellKind.Code) {
const supportedLanguages = activeKernel?.supportedLanguages ?? modeService.getRegisteredModes();
const supportedLanguages = activeKernel?.supportedLanguages ?? languageService.getRegisteredModes();
const defaultLanguage = supportedLanguages[0] || 'plaintext';
if (cell?.cellKind === CellKind.Code) {
language = cell.language;

View file

@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
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 { localize } from 'vs/nls';
import { MenuId, MenuItemAction, registerAction2 } from 'vs/platform/actions/common/actions';
import { ICommandService } from 'vs/platform/commands/common/commands';
@ -371,13 +371,13 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction<ICellR
const topItems: ILanguagePickInput[] = [];
const mainItems: ILanguagePickInput[] = [];
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
const modelService = accessor.get(IModelService);
const quickInputService = accessor.get(IQuickInputService);
const languageDetectionService = accessor.get(ILanguageDetectionService);
const providerLanguages = new Set([
...(context.notebookEditor.activeKernel?.supportedLanguages ?? modeService.getRegisteredModes()),
...(context.notebookEditor.activeKernel?.supportedLanguages ?? languageService.getRegisteredModes()),
'markdown'
]);
@ -389,7 +389,7 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction<ICellR
description = localize('languageDescriptionConfigured', "({0})", languageId);
}
const languageName = modeService.getLanguageName(languageId);
const languageName = languageService.getLanguageName(languageId);
if (!languageName) {
// Notebook has unrecognized language
return;
@ -397,7 +397,7 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction<ICellR
const item = <ILanguagePickInput>{
label: languageName,
iconClasses: getIconClasses(modelService, modeService, this.getFakeResource(languageName, modeService)),
iconClasses: getIconClasses(modelService, languageService, this.getFakeResource(languageName, languageService)),
description,
languageId
};
@ -459,14 +459,14 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction<ICellR
/**
* Copied from editorStatus.ts
*/
private getFakeResource(lang: string, modeService: IModeService): URI | undefined {
private getFakeResource(lang: string, languageService: ILanguageService): URI | undefined {
let fakeResource: URI | undefined;
const extensions = modeService.getExtensions(lang);
const extensions = languageService.getExtensions(lang);
if (extensions?.length) {
fakeResource = URI.file(extensions[0]);
} else {
const filenames = modeService.getFilenames(lang);
const filenames = languageService.getFilenames(lang);
if (filenames?.length) {
fakeResource = URI.file(filenames[0]);
}

View file

@ -6,7 +6,7 @@
import { Iterable } from 'vs/base/common/iterator';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
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 { localize } from 'vs/nls';
import { MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@ -408,7 +408,7 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
if (typeof idx !== 'number') {
return;
}
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
if (context.cell.cellKind === CellKind.Markup) {
const nextCell = context.notebookEditor.cellAt(idx + 1);
@ -416,7 +416,7 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
if (nextCell) {
context.notebookEditor.focusNotebookCell(nextCell, 'container');
} else {
const newCell = insertCell(modeService, context.notebookEditor, idx, CellKind.Markup, 'below');
const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Markup, 'below');
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, 'editor');
@ -429,7 +429,7 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
if (nextCell) {
context.notebookEditor.focusNotebookCell(nextCell, 'container');
} else {
const newCell = insertCell(modeService, context.notebookEditor, idx, CellKind.Code, 'below');
const newCell = insertCell(languageService, context.notebookEditor, idx, CellKind.Code, 'below');
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, 'editor');
@ -457,10 +457,10 @@ registerAction2(class ExecuteCellInsertBelow extends NotebookCellAction {
async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise<void> {
const idx = context.notebookEditor.getCellIndex(context.cell);
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
const newFocusMode = context.cell.focusMode === CellFocusMode.Editor ? 'editor' : 'container';
const newCell = insertCell(modeService, context.notebookEditor, idx, context.cell.cellKind, 'below');
const newCell = insertCell(languageService, context.notebookEditor, idx, context.cell.cellKind, 'below');
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, newFocusMode);
}

View file

@ -5,7 +5,7 @@
import { Codicon } from 'vs/base/common/codicons';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { localize } from 'vs/nls';
import { IAction2Options, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@ -43,14 +43,14 @@ abstract class InsertCellCommand extends NotebookAction {
context.notebookEditor.focus();
}
const modeService = accessor.get(IModeService);
const languageService = accessor.get(ILanguageService);
if (context.cell) {
const idx = context.notebookEditor.getCellIndex(context.cell);
newCell = insertCell(modeService, context.notebookEditor, idx, this.kind, this.direction, undefined, true);
newCell = insertCell(languageService, context.notebookEditor, idx, this.kind, this.direction, undefined, true);
} else {
const focusRange = context.notebookEditor.getFocus();
const next = Math.max(focusRange.end - 1, 0);
newCell = insertCell(modeService, context.notebookEditor, next, this.kind, this.direction, undefined, true);
newCell = insertCell(languageService, context.notebookEditor, next, this.kind, this.direction, undefined, true);
}
if (newCell) {
@ -185,8 +185,8 @@ registerAction2(class InsertCodeCellAtTopAction extends NotebookAction {
}
async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext): Promise<void> {
const modeService = accessor.get(IModeService);
const newCell = insertCell(modeService, context.notebookEditor, 0, CellKind.Code, 'above', undefined, true);
const languageService = accessor.get(ILanguageService);
const newCell = insertCell(languageService, context.notebookEditor, 0, CellKind.Code, 'above', undefined, true);
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, 'editor');
@ -212,8 +212,8 @@ registerAction2(class InsertMarkdownCellAtTopAction extends NotebookAction {
}
async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext): Promise<void> {
const modeService = accessor.get(IModeService);
const newCell = insertCell(modeService, context.notebookEditor, 0, CellKind.Markup, 'above', undefined, true);
const languageService = accessor.get(ILanguageService);
const newCell = insertCell(languageService, context.notebookEditor, 0, CellKind.Markup, 'above', undefined, true);
if (newCell) {
context.notebookEditor.focusNotebookCell(newCell, 'editor');

View file

@ -13,7 +13,7 @@ import { CellDiffSideBySideRenderTemplate, CellDiffSingleSideRenderTemplate, Dif
import { CodeEditorWidget, ICodeEditorWidgetOptions } from 'vs/editor/browser/widget/codeEditorWidget';
import { DiffEditorWidget } from 'vs/editor/browser/widget/diffEditorWidget';
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 { CellEditType, CellUri, NotebookCellMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@ -303,7 +303,7 @@ abstract class AbstractElementRenderer extends Disposable {
readonly templateData: CellDiffSingleSideRenderTemplate | CellDiffSideBySideRenderTemplate,
readonly style: 'left' | 'right' | 'full',
protected readonly instantiationService: IInstantiationService,
protected readonly modeService: IModeService,
protected readonly languageService: ILanguageService,
protected readonly modelService: IModelService,
protected readonly textModelService: ITextModelService,
protected readonly contextMenuService: IContextMenuService,
@ -596,7 +596,7 @@ abstract class AbstractElementRenderer extends Disposable {
this.layout({ metadataHeight: true });
this._metadataEditorDisposeStore.add(this._metadataEditor);
const mode = this.modeService.create('jsonc');
const mode = this.languageService.create('jsonc');
const originalMetadataSource = getFormatedMetadataJSON(this.notebookEditor.textModel!,
this.cell.type === 'insert'
? this.cell.modified!.metadata || {}
@ -630,7 +630,7 @@ abstract class AbstractElementRenderer extends Disposable {
const originalOutputsSource = getFormatedOutputJSON(this.cell.original?.outputs || []);
const modifiedOutputsSource = getFormatedOutputJSON(this.cell.modified?.outputs || []);
if (originalOutputsSource !== modifiedOutputsSource) {
const mode = this.modeService.create('json');
const mode = this.languageService.create('json');
const originalModel = this.modelService.createModel(originalOutputsSource, mode, undefined, true);
const modifiedModel = this.modelService.createModel(modifiedOutputsSource, mode, undefined, true);
this._outputEditorDisposeStore.add(originalModel);
@ -690,7 +690,7 @@ abstract class AbstractElementRenderer extends Disposable {
}, {});
this._outputEditorDisposeStore.add(this._outputEditor);
const mode = this.modeService.create('json');
const mode = this.languageService.create('json');
const originaloutputSource = getFormatedOutputJSON(
this.notebookEditor.textModel!.transientOptions.transientOutputs
? []
@ -755,7 +755,7 @@ abstract class SingleSideDiffElement extends AbstractElementRenderer {
templateData: CellDiffSingleSideRenderTemplate,
style: 'left' | 'right' | 'full',
instantiationService: IInstantiationService,
modeService: IModeService,
languageService: ILanguageService,
modelService: IModelService,
textModelService: ITextModelService,
contextMenuService: IContextMenuService,
@ -771,7 +771,7 @@ abstract class SingleSideDiffElement extends AbstractElementRenderer {
templateData,
style,
instantiationService,
modeService,
languageService,
modelService,
textModelService,
contextMenuService,
@ -946,7 +946,7 @@ export class DeletedElement extends SingleSideDiffElement {
notebookEditor: INotebookTextDiffEditor,
cell: SingleSideDiffElementViewModel,
templateData: CellDiffSingleSideRenderTemplate,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IModelService modelService: IModelService,
@ITextModelService textModelService: ITextModelService,
@IInstantiationService instantiationService: IInstantiationService,
@ -958,7 +958,7 @@ export class DeletedElement extends SingleSideDiffElement {
@IConfigurationService configurationService: IConfigurationService,
) {
super(notebookEditor, cell, templateData, 'left', instantiationService, modeService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
super(notebookEditor, cell, templateData, 'left', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
}
styleContainer(container: HTMLElement) {
@ -1099,7 +1099,7 @@ export class InsertElement extends SingleSideDiffElement {
cell: SingleSideDiffElementViewModel,
templateData: CellDiffSingleSideRenderTemplate,
@IInstantiationService instantiationService: IInstantiationService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IModelService modelService: IModelService,
@ITextModelService textModelService: ITextModelService,
@IContextMenuService contextMenuService: IContextMenuService,
@ -1109,7 +1109,7 @@ export class InsertElement extends SingleSideDiffElement {
@IContextKeyService contextKeyService: IContextKeyService,
@IConfigurationService configurationService: IConfigurationService,
) {
super(notebookEditor, cell, templateData, 'right', instantiationService, modeService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
super(notebookEditor, cell, templateData, 'right', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
}
styleContainer(container: HTMLElement): void {
@ -1257,7 +1257,7 @@ export class ModifiedElement extends AbstractElementRenderer {
cell: SideBySideDiffElementViewModel,
templateData: CellDiffSideBySideRenderTemplate,
@IInstantiationService instantiationService: IInstantiationService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@IModelService modelService: IModelService,
@ITextModelService textModelService: ITextModelService,
@IContextMenuService contextMenuService: IContextMenuService,
@ -1267,7 +1267,7 @@ export class ModifiedElement extends AbstractElementRenderer {
@IContextKeyService contextKeyService: IContextKeyService,
@IConfigurationService configurationService: IConfigurationService,
) {
super(notebookEditor, cell, templateData, 'full', instantiationService, modeService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
super(notebookEditor, cell, templateData, 'full', instantiationService, languageService, modelService, textModelService, contextMenuService, keybindingService, notificationService, menuService, contextKeyService, configurationService);
this.cell = cell;
this.templateData = templateData;
}

View file

@ -13,7 +13,7 @@ import { format } from 'vs/base/common/jsonFormatter';
import { applyEdits } from 'vs/base/common/jsonEdit';
import { ITextModel, ITextBufferFactory, DefaultEndOfLine, ITextBuffer } from 'vs/editor/common/model';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageSelection, ILanguageService } from 'vs/editor/common/services/languageService';
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import * as nls from 'vs/nls';
import { Extensions, IConfigurationPropertySchema, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
@ -238,7 +238,7 @@ class CellContentProvider implements ITextModelContentProvider {
constructor(
@ITextModelService textModelService: ITextModelService,
@IModelService private readonly _modelService: IModelService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
) {
this._registration = textModelService.registerTextModelContentProvider(CellUri.scheme, this);
@ -274,8 +274,8 @@ class CellContentProvider implements ITextModelContentProvider {
return cell.textBuffer.getLineContent(1).substr(0, limit);
}
};
const languageId = this._modeService.getModeIdForLanguageName(cell.language);
const languageSelection = languageId ? this._modeService.create(languageId) : (cell.cellKind === CellKind.Markup ? this._modeService.create('markdown') : this._modeService.createByFilepathOrFirstLine(resource, cell.textBuffer.getLineContent(1)));
const languageId = this._languageService.getModeIdForLanguageName(cell.language);
const languageSelection = languageId ? this._languageService.create(languageId) : (cell.cellKind === CellKind.Markup ? this._languageService.create('markdown') : this._languageService.createByFilepathOrFirstLine(resource, cell.textBuffer.getLineContent(1)));
result = this._modelService.createModel(
bufferFactory,
languageSelection,
@ -302,7 +302,7 @@ class CellInfoContentProvider {
constructor(
@ITextModelService textModelService: ITextModelService,
@IModelService private readonly _modelService: IModelService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ILabelService private readonly _labelService: ILabelService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
) {
@ -349,7 +349,7 @@ class CellInfoContentProvider {
const ref = await this._notebookModelResolverService.resolve(data.notebook);
let result: ITextModel | null = null;
const mode = this._modeService.create('json');
const mode = this._languageService.create('json');
for (const cell of ref.object.notebook.cells) {
if (cell.handle === data.handle) {
@ -382,7 +382,7 @@ class CellInfoContentProvider {
if (streamOutputData) {
return {
content: streamOutputData,
mode: this._modeService.create('plaintext')
mode: this._languageService.create('plaintext')
};
}
@ -396,7 +396,7 @@ class CellInfoContentProvider {
}, cell: NotebookCellTextModel) {
let result: { content: string, mode: ILanguageSelection } | undefined = undefined;
const mode = this._modeService.create('json');
const mode = this._languageService.create('json');
const op = cell.outputs.find(op => op.outputId === data.outputId);
const streamOutputData = this.parseStreamOutput(op);
if (streamOutputData) {

View file

@ -13,7 +13,7 @@ import { IDimension } from 'vs/editor/common/editorCommon';
import { IReadonlyTextBuffer } from 'vs/editor/common/model';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { localize } from 'vs/nls';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@ -44,7 +44,7 @@ export class CodeCell extends Disposable {
@INotebookCellStatusBarService readonly notebookCellStatusBarService: INotebookCellStatusBarService,
@IKeybindingService readonly keybindingService: IKeybindingService,
@IOpenerService readonly openerService: IOpenerService,
@IModeService readonly modeService: IModeService,
@ILanguageService readonly languageService: ILanguageService,
) {
super();
@ -381,7 +381,7 @@ export class CodeCell extends Disposable {
}
private _getRichText(buffer: IReadonlyTextBuffer, language: string) {
return tokenizeToString(buffer.getLineContent(1), this.modeService.languageIdCodec, TokenizationRegistry.get(language)!);
return tokenizeToString(buffer.getLineContent(1), this.languageService.languageIdCodec, TokenizationRegistry.get(language)!);
}
private _removeInputCollapsePreview() {

View file

@ -24,7 +24,7 @@ import { IReadonlyTextBuffer } from 'vs/editor/common/model';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { MarkdownCellRenderTemplate } from 'vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { CellEditorOptions } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { CellPart } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellPart';
@ -53,7 +53,7 @@ export class StatefulMarkdownCell extends Disposable {
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@INotebookCellStatusBarService readonly notebookCellStatusBarService: INotebookCellStatusBarService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IConfigurationService private configurationService: IConfigurationService,
) {
super();
@ -254,7 +254,7 @@ export class StatefulMarkdownCell extends Disposable {
}
private getRichText(buffer: IReadonlyTextBuffer, language: string) {
return tokenizeToString(buffer.getLineContent(1), this.modeService.languageIdCodec, TokenizationRegistry.get(language)!);
return tokenizeToString(buffer.getLineContent(1), this.languageService.languageIdCodec, TokenizationRegistry.get(language)!);
}
private viewUpdateEditing(): void {

View file

@ -18,7 +18,7 @@ import * as UUID from 'vs/base/common/uuid';
import { TokenizationRegistry } from 'vs/editor/common/modes';
import { generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import * as nls from 'vs/nls';
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
@ -130,7 +130,7 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Disposable {
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
) {
super();
@ -760,17 +760,17 @@ var requirejs = (function() {
for (const { id, value, lang } of data.codeBlocks) {
// The language id may be a language aliases (e.g.js instead of javascript)
const languageId = this.modeService.getModeIdForLanguageName(lang);
const languageId = this.languageService.getModeIdForLanguageName(lang);
if (!languageId) {
continue;
}
this.modeService.triggerMode(languageId);
this.languageService.triggerMode(languageId);
TokenizationRegistry.getPromise(languageId)?.then(tokenization => {
if (this._disposed) {
return;
}
const html = tokenizeToString(value, this.modeService.languageIdCodec, tokenization);
const html = tokenizeToString(value, this.languageService.languageIdCodec, tokenization);
this._sendMessageToWebview({
type: 'tokenizedCodeBlock',
html,

View file

@ -13,7 +13,7 @@ import * as model from 'vs/editor/common/model';
import { PieceTreeTextBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer';
import { PieceTreeTextBufferBuilder } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
import { TextModel } from 'vs/editor/common/model/textModel';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { NotebookCellOutputTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel';
import { CellInternalMetadataChangedEvent, CellKind, ICell, ICellOutput, IOutputDto, IOutputItemDto, NotebookCellInternalMetadata, NotebookCellMetadata, NotebookCellOutputsSplice, TransientOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon';
@ -79,20 +79,20 @@ export class NotebookCellTextModel extends Disposable implements ICell {
set language(newLanguage: string) {
if (this._textModel
// 1. the language update is from workspace edit, checking if it's the same as text model's mode
&& this._textModel.getLanguageId() === this._modeService.getModeIdForLanguageName(newLanguage)
&& this._textModel.getLanguageId() === this._languageService.getModeIdForLanguageName(newLanguage)
// 2. the text model's mode might be the same as the `this.language`, even if the language friendly name is not the same, we should not trigger an update
&& this._textModel.getLanguageId() === this._modeService.getModeIdForLanguageName(this.language)) {
&& this._textModel.getLanguageId() === this._languageService.getModeIdForLanguageName(this.language)) {
return;
}
const newMode = this._modeService.getModeIdForLanguageName(newLanguage);
const newMode = this._languageService.getModeIdForLanguageName(newLanguage);
if (newMode === null) {
return;
}
if (this._textModel) {
const languageId = this._modeService.create(newMode);
const languageId = this._languageService.create(newMode);
this._textModel.setMode(languageId.languageId);
}
@ -168,7 +168,7 @@ export class NotebookCellTextModel extends Disposable implements ICell {
// Init language from text model
// The language defined in the cell might not be supported in the editor so the text model might be using the default fallback
// If so let's not modify the language
if (!(this._modeService.getModeId(this.language) === null && (this._textModel.getLanguageId() === 'plaintext' || this._textModel.getLanguageId() === 'jupyter'))) {
if (!(this._languageService.getModeId(this.language) === null && (this._textModel.getLanguageId() === 'plaintext' || this._textModel.getLanguageId() === 'jupyter'))) {
this.language = this._textModel.getLanguageId();
}
@ -201,7 +201,7 @@ export class NotebookCellTextModel extends Disposable implements ICell {
metadata: NotebookCellMetadata | undefined,
internalMetadata: NotebookCellInternalMetadata | undefined,
public readonly transientOptions: TransientOptions,
private readonly _modeService: IModeService
private readonly _languageService: ILanguageService
) {
super();
this._outputs = outputs.map(op => new NotebookCellOutputTextModel(op));

View file

@ -17,7 +17,7 @@ import { NotebookCellOutputTextModel } from 'vs/workbench/contrib/notebook/commo
import { IModelService } from 'vs/editor/common/services/modelService';
import { Schemas } from 'vs/base/common/network';
import { isEqual } from 'vs/base/common/resources';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ITextModel } from 'vs/editor/common/model';
import { TextModel } from 'vs/editor/common/model/textModel';
import { isDefined } from 'vs/base/common/types';
@ -209,7 +209,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
options: TransientOptions,
@IUndoRedoService private readonly _undoService: IUndoRedoService,
@IModelService private readonly _modelService: IModelService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
) {
super();
this.transientOptions = options;
@ -277,7 +277,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const mainCells = cells.map(cell => {
const cellHandle = this._cellhandlePool++;
const cellUri = CellUri.generate(this.uri, cellHandle);
return new NotebookCellTextModel(cellUri, cellHandle, cell.source, cell.language, cell.mime, cell.cellKind, cell.outputs, cell.metadata, cell.internalMetadata, this.transientOptions, this._modeService);
return new NotebookCellTextModel(cellUri, cellHandle, cell.source, cell.language, cell.mime, cell.cellKind, cell.outputs, cell.metadata, cell.internalMetadata, this.transientOptions, this._languageService);
});
for (let i = 0; i < mainCells.length; i++) {
@ -601,7 +601,7 @@ export class NotebookTextModel extends Disposable implements INotebookTextModel
const cell = new NotebookCellTextModel(
cellUri, cellHandle,
cellDto.source, cellDto.language, cellDto.mime, cellDto.cellKind, cellDto.outputs || [], cellDto.metadata, cellDto.internalMetadata, this.transientOptions,
this._modeService
this._languageService
);
const textModel = this._modelService.getModel(cellUri);
if (textModel && textModel instanceof TextModel) {

View file

@ -7,7 +7,7 @@ import * as assert from 'assert';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { Mimes } from 'vs/base/common/mime';
import { URI } from 'vs/base/common/uri';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { CellKind, CellUri, diff, MimeTypeDisplayOrder, NotebookWorkingCopyTypeIdentifier } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { cellIndexesToRanges, cellRangesToIndexes, reduceCellRanges } from 'vs/workbench/contrib/notebook/common/notebookRange';
@ -16,12 +16,12 @@ import { setupInstantiationService, TestCell } from 'vs/workbench/contrib/notebo
suite('NotebookCommon', () => {
let disposables: DisposableStore;
let instantiationService: TestInstantiationService;
let modeService: IModeService;
let languageService: ILanguageService;
suiteSetup(() => {
disposables = new DisposableStore();
instantiationService = setupInstantiationService(disposables);
modeService = instantiationService.get(IModeService);
languageService = instantiationService.get(ILanguageService);
});
suiteTeardown(() => disposables.dispose());
@ -231,7 +231,7 @@ suite('NotebookCommon', () => {
for (let i = 0; i < 5; i++) {
cells.push(
new TestCell('notebook', i, `var a = ${i};`, 'javascript', CellKind.Code, [], modeService)
new TestCell('notebook', i, `var a = ${i};`, 'javascript', CellKind.Code, [], languageService)
);
}
@ -257,8 +257,8 @@ suite('NotebookCommon', () => {
]
);
const cellA = new TestCell('notebook', 6, 'var a = 6;', 'javascript', CellKind.Code, [], modeService);
const cellB = new TestCell('notebook', 7, 'var a = 7;', 'javascript', CellKind.Code, [], modeService);
const cellA = new TestCell('notebook', 6, 'var a = 6;', 'javascript', CellKind.Code, [], languageService);
const cellB = new TestCell('notebook', 7, 'var a = 7;', 'javascript', CellKind.Code, [], languageService);
const modifiedCells = [
cells[0],

View file

@ -5,7 +5,7 @@
import * as assert from 'assert';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { FoldingModel, updateFoldingStateAtIndex } from 'vs/workbench/contrib/notebook/browser/contrib/fold/foldingModel';
import { runDeleteAction } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations';
@ -27,12 +27,12 @@ suite('NotebookCellList focus/selection', () => {
let disposables: DisposableStore;
let instantiationService: TestInstantiationService;
let modeService: IModeService;
let languageService: ILanguageService;
suiteSetup(() => {
disposables = new DisposableStore();
instantiationService = setupInstantiationService(disposables);
modeService = instantiationService.get(IModeService);
languageService = instantiationService.get(ILanguageService);
});
suiteTeardown(() => disposables.dispose());
@ -219,8 +219,8 @@ suite('NotebookCellList focus/selection', () => {
// mimic undo
editor.textModel.applyEdits([{
editType: CellEditType.Replace, index: 0, count: 0, cells: [
new TestCell(viewModel.viewType, 7, '# header f', 'markdown', CellKind.Code, [], modeService),
new TestCell(viewModel.viewType, 8, 'var g = 5;', 'javascript', CellKind.Code, [], modeService)
new TestCell(viewModel.viewType, 7, '# header f', 'markdown', CellKind.Code, [], languageService),
new TestCell(viewModel.viewType, 8, 'var g = 5;', 'javascript', CellKind.Code, [], languageService)
]
}], true, undefined, () => undefined, undefined, false);
viewModel.updateFoldingRanges(foldingModel.regions);

View file

@ -7,7 +7,7 @@ import * as assert from 'assert';
import { VSBuffer } from 'vs/base/common/buffer';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { Mimes } from 'vs/base/common/mime';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { CellEditType, CellKind, ICellEditOperation, NotebookTextModelChangedEvent, NotebookTextModelWillAddRemoveEvent, SelectionStateType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
@ -16,12 +16,12 @@ import { setupInstantiationService, TestCell, valueBytesFromString, withTestNote
suite('NotebookTextModel', () => {
let disposables: DisposableStore;
let instantiationService: TestInstantiationService;
let modeService: IModeService;
let languageService: ILanguageService;
suiteSetup(() => {
disposables = new DisposableStore();
instantiationService = setupInstantiationService(disposables);
modeService = instantiationService.get(IModeService);
languageService = instantiationService.get(ILanguageService);
instantiationService.spy(IUndoRedoService, 'pushElement');
});
@ -38,8 +38,8 @@ suite('NotebookTextModel', () => {
(editor) => {
const textModel = editor.textModel;
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => undefined, undefined);
assert.strictEqual(textModel.cells.length, 6);
@ -61,8 +61,8 @@ suite('NotebookTextModel', () => {
(editor) => {
const textModel = editor.textModel;
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => undefined, undefined);
assert.strictEqual(textModel.cells.length, 6);
@ -106,7 +106,7 @@ suite('NotebookTextModel', () => {
const textModel = editor.textModel;
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => undefined, undefined);
assert.strictEqual(textModel.cells.length, 4);
@ -128,7 +128,7 @@ suite('NotebookTextModel', () => {
const textModel = editor.textModel;
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => undefined, undefined);
assert.strictEqual(textModel.cells.length, 4);
@ -150,7 +150,7 @@ suite('NotebookTextModel', () => {
(editor) => {
const textModel = editor.textModel;
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => undefined, undefined);
assert.strictEqual(textModel.cells.length, 4);
@ -402,7 +402,7 @@ suite('NotebookTextModel', () => {
textModel.applyEdits([
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], modeService)] },
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
], true, undefined, () => ({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] }), undefined);
assert.strictEqual(textModel.cells.length, 4);

View file

@ -9,7 +9,7 @@ import { URI } from 'vs/base/common/uri';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { TrackedRangeStickiness } from 'vs/editor/common/model';
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 { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
@ -34,7 +34,7 @@ suite('NotebookViewModel', () => {
let bulkEditService: IBulkEditService;
let undoRedoService: IUndoRedoService;
let modelService: IModelService;
let modeService: IModeService;
let languageService: ILanguageService;
suiteSetup(() => {
disposables = new DisposableStore();
@ -43,7 +43,7 @@ suite('NotebookViewModel', () => {
bulkEditService = instantiationService.get(IBulkEditService);
undoRedoService = instantiationService.get(IUndoRedoService);
modelService = instantiationService.get(IModelService);
modeService = instantiationService.get(IModeService);
languageService = instantiationService.get(ILanguageService);
instantiationService.stub(IConfigurationService, new TestConfigurationService());
instantiationService.stub(IThemeService, new TestThemeService());
@ -52,7 +52,7 @@ suite('NotebookViewModel', () => {
suiteTeardown(() => disposables.dispose());
test('ctor', function () {
const notebook = new NotebookTextModel('notebook', URI.parse('test'), [], {}, { transientCellMetadata: {}, transientDocumentMetadata: {}, transientOutputs: false }, undoRedoService, modelService, modeService);
const notebook = new NotebookTextModel('notebook', URI.parse('test'), [], {}, { transientCellMetadata: {}, transientDocumentMetadata: {}, transientOutputs: false }, undoRedoService, modelService, languageService);
const model = new NotebookEditorTestModel(notebook);
const viewContext = new ViewContext(new NotebookOptions(instantiationService.get(IConfigurationService)), new NotebookEventDispatcher());
const viewModel = new NotebookViewModel('notebook', model.notebook, viewContext, null, { isReadOnly: false }, instantiationService, bulkEditService, undoRedoService, textModelService);

View file

@ -17,7 +17,7 @@ import { FontInfo } from 'vs/editor/common/config/fontInfo';
import { ILanguageConfigurationService } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { TestLanguageConfigurationService } from 'vs/editor/test/common/modes/testLanguageConfigurationService';
@ -63,9 +63,9 @@ export class TestCell extends NotebookCellTextModel {
language: string,
cellKind: CellKind,
outputs: IOutputDto[],
modeService: IModeService,
languageService: ILanguageService,
) {
super(CellUri.generate(URI.parse('test:///fake/notebook'), handle), handle, source, language, Mimes.text, cellKind, outputs, undefined, undefined, { transientCellMetadata: {}, transientDocumentMetadata: {}, transientOutputs: false }, modeService);
super(CellUri.generate(URI.parse('test:///fake/notebook'), handle), handle, source, language, Mimes.text, cellKind, outputs, undefined, undefined, { transientCellMetadata: {}, transientDocumentMetadata: {}, transientOutputs: false }, languageService);
}
}
@ -158,7 +158,7 @@ export class NotebookEditorTestModel extends EditorModel implements INotebookEdi
export function setupInstantiationService(disposables = new DisposableStore()) {
const instantiationService = new TestInstantiationService();
instantiationService.stub(IModeService, disposables.add(new ModeServiceImpl()));
instantiationService.stub(ILanguageService, disposables.add(new ModeServiceImpl()));
instantiationService.stub(IUndoRedoService, instantiationService.createInstance(UndoRedoService));
instantiationService.stub(IConfigurationService, new TestConfigurationService());
instantiationService.stub(IThemeService, new TestThemeService());

View file

@ -12,7 +12,7 @@ import { URI } from 'vs/base/common/uri';
import { Promises, ThrottledDelayer } from 'vs/base/common/async';
import { IFileService } from 'vs/platform/files/common/files';
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 { Disposable, toDisposable, IDisposable, dispose, MutableDisposable } from 'vs/base/common/lifecycle';
import { isNumber } from 'vs/base/common/types';
import { EditOperation } from 'vs/editor/common/core/editOperation';
@ -110,7 +110,7 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
private readonly file: URI,
@IFileService private readonly fileService: IFileService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@ILogService logService: ILogService,
@IEditorWorkerService private readonly editorWorkerService: IEditorWorkerService,
) {
@ -163,7 +163,7 @@ export class FileOutputChannelModel extends Disposable implements IOutputChannel
if (this.model) {
this.model.setValue(content);
} else {
this.model = this.modelService.createModel(content, this.modeService.create(this.mimeType), this.modelUri);
this.model = this.modelService.createModel(content, this.languageService.create(this.mimeType), this.modelUri);
this.fileHandler.watch(this.etag);
const disposable = this.model.onWillDispose(() => {
this.cancelModelUpdate();
@ -328,12 +328,12 @@ class OutputChannelBackedByFile extends FileOutputChannelModel implements IOutpu
file: URI,
@IFileService fileService: IFileService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@ILanguageService languageService: ILanguageService,
@ILoggerService loggerService: ILoggerService,
@ILogService logService: ILogService,
@IEditorWorkerService editorWorkerService: IEditorWorkerService
) {
super(modelUri, mimeType, file, fileService, modelService, modeService, logService, editorWorkerService);
super(modelUri, mimeType, file, fileService, modelService, languageService, logService, editorWorkerService);
// Donot rotate to check for the file reset
this.logger = loggerService.createLogger(file, { always: true, donotRotate: true, donotUseFormatters: true });

View file

@ -9,7 +9,7 @@ import { TextResourceEditorInput } from 'vs/workbench/common/editor/textResource
import { ITextModelService, ITextModelContentProvider } from 'vs/editor/common/services/resolverService';
import { ITextModel } from 'vs/editor/common/model';
import { ILifecycleService, LifecyclePhase, StartupKindToString } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ITimerService } from 'vs/workbench/services/timer/browser/timerService';
@ -82,7 +82,7 @@ class PerfModelContentProvider implements ITextModelContentProvider {
constructor(
@IModelService private readonly _modelService: IModelService,
@IModeService private readonly _modeService: IModeService,
@ILanguageService private readonly _languageService: ILanguageService,
@ICodeEditorService private readonly _editorService: ICodeEditorService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@ITimerService private readonly _timerService: ITimerService,
@ -94,7 +94,7 @@ class PerfModelContentProvider implements ITextModelContentProvider {
if (!this._model || this._model.isDisposed()) {
dispose(this._modelDisposables);
const langId = this._modeService.create('markdown');
const langId = this._languageService.create('markdown');
this._model = this._modelService.getModel(resource) || this._modelService.createModel('Loading...', langId, resource);
this._modelDisposables.push(langId.onDidChange(e => {

View file

@ -7,7 +7,7 @@ import { Action } from 'vs/base/common/actions';
import { URI } from 'vs/base/common/uri';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
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 * as nls from 'vs/nls';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
@ -21,7 +21,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
id: string,
label: string,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IPreferencesService private readonly preferencesService: IPreferencesService
) {
@ -29,23 +29,23 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
}
override async run(): Promise<void> {
const languages = this.modeService.getRegisteredLanguageNames();
const languages = this.languageService.getRegisteredLanguageNames();
const picks: IQuickPickItem[] = languages.sort().map((lang, index) => {
const description: string = nls.localize('languageDescriptionConfigured', "({0})", this.modeService.getModeIdForLanguageName(lang.toLowerCase()));
const description: string = nls.localize('languageDescriptionConfigured', "({0})", this.languageService.getModeIdForLanguageName(lang.toLowerCase()));
// construct a fake resource to be able to show nice icons if any
let fakeResource: URI | undefined;
const extensions = this.modeService.getExtensions(lang);
const extensions = this.languageService.getExtensions(lang);
if (extensions && extensions.length) {
fakeResource = URI.file(extensions[0]);
} else {
const filenames = this.modeService.getFilenames(lang);
const filenames = this.languageService.getFilenames(lang);
if (filenames && filenames.length) {
fakeResource = URI.file(filenames[0]);
}
}
return {
label: lang,
iconClasses: getIconClasses(this.modelService, this.modeService, fakeResource),
iconClasses: getIconClasses(this.modelService, this.languageService, fakeResource),
description
} as IQuickPickItem;
});
@ -53,7 +53,7 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
await this.quickInputService.pick(picks, { placeHolder: nls.localize('pickLanguage', "Select Language") })
.then(pick => {
if (pick) {
const languageId = this.modeService.getModeIdForLanguageName(pick.label.toLowerCase());
const languageId = this.languageService.getModeIdForLanguageName(pick.label.toLowerCase());
if (typeof languageId === 'string') {
return this.preferencesService.openUserSettings({ jsonEditor: true, revealSetting: { key: `[${languageId}]`, edit: true } });
}

View file

@ -8,7 +8,7 @@ import { isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { ITextModel } from 'vs/editor/common/model';
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 * as nls from 'vs/nls';
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -35,7 +35,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
@IModelService private readonly modelService: IModelService,
@ITextModelService private readonly textModelResolverService: ITextModelService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@ -122,7 +122,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
let schema = schemaRegistry.getSchemaContributions().schemas[uri.toString()];
if (schema) {
const modelContent = JSON.stringify(schema);
const languageSelection = this.modeService.create('jsonc');
const languageSelection = this.languageService.create('jsonc');
const model = this.modelService.createModel(modelContent, languageSelection, uri);
const disposables = new DisposableStore();
disposables.add(schemaRegistry.onDidChangeSchema(schemaUri => {

View file

@ -67,7 +67,7 @@ import { LinkDetector } from 'vs/editor/contrib/links/links';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ILanguageService } from 'vs/editor/common/services/languageService';
import { ILabelService } from 'vs/platform/label/common/label';
import { KeyCode } from 'vs/base/common/keyCodes';
import { DEFAULT_FONT_FAMILY } from 'vs/workbench/browser/style';
@ -1649,7 +1649,7 @@ class SCMInputWidget extends Disposable {
this.configurationService.updateValue('editor.wordBasedSuggestions', false, { resource: uri }, ConfigurationTarget.MEMORY);
}
const textModel = this.modelService.getModel(uri) ?? this.modelService.createModel('', this.modeService.create('scminput'), uri);
const textModel = this.modelService.getModel(uri) ?? this.modelService.createModel('', this.languageService.create('scminput'), uri);
this.inputEditor.setModel(textModel);
// Validation
@ -1769,7 +1769,7 @@ class SCMInputWidget extends Disposable {
overflowWidgetsDomNode: HTMLElement,
@IContextKeyService contextKeyService: IContextKeyService,
@IModelService private modelService: IModelService,
@IModeService private modeService: IModeService,
@ILanguageService private languageService: ILanguageService,
@IKeybindingService private keybindingService: IKeybindingService,
@IConfigurationService private configurationService: IConfigurationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,

View file

@ -23,7 +23,7 @@ import { DisposableStore, IDisposable, toDisposable, MutableDisposable, Disposab
import { ILabelService } from 'vs/platform/label/common/label';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
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 { localize } from 'vs/nls';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -171,7 +171,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
@IFileService private readonly fileService: IFileService,
@ILabelService private readonly labelService: ILabelService,
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IEditorService private readonly editorService: IEditorService,
@ -896,7 +896,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
label,
ariaLabel: isDirty ? localize('filePickAriaLabelDirty', "{0} unsaved changes", labelAndDescription) : labelAndDescription,
description,
iconClasses: getIconClasses(this.modelService, this.modeService, resource).concat(extraClasses),
iconClasses: getIconClasses(this.modelService, this.languageService, resource).concat(extraClasses),
buttons: (() => {
const openSideBySideDirection = configuration.openSideBySideDirection;
const buttons: IQuickInputButton[] = [];

View file

@ -10,7 +10,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IReplaceService } from 'vs/workbench/contrib/search/common/replace';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
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 { Match, FileMatch, FileMatchOrMatch, ISearchWorkbenchService } from 'vs/workbench/contrib/search/common/searchModel';
import { IProgress, IProgressStep } from 'vs/platform/progress/common/progress';
import { ITextModelService, ITextModelContentProvider } from 'vs/editor/common/services/resolverService';
@ -57,7 +57,7 @@ export class ReplacePreviewContentProvider implements ITextModelContentProvider,
class ReplacePreviewModel extends Disposable {
constructor(
@IModelService private readonly modelService: IModelService,
@IModeService private readonly modeService: IModeService,
@ILanguageService private readonly languageService: ILanguageService,
@ITextModelService private readonly textModelResolverService: ITextModelService,
@IReplaceService private readonly replaceService: IReplaceService,
@ISearchWorkbenchService private readonly searchWorkbenchService: ISearchWorkbenchService
@ -71,7 +71,7 @@ class ReplacePreviewModel extends Disposable {
const ref = this._register(await this.textModelResolverService.createModelReference(fileResource));
const sourceModel = ref.object.textEditorModel;
const sourceModelModeId = sourceModel.getLanguageId();
const replacePreviewModel = this.modelService.createModel(createTextBufferFactoryFromSnapshot(sourceModel.createSnapshot()), this.modeService.create(sourceModelModeId), replacePreviewUri);
const replacePreviewModel = this.modelService.createModel(createTextBufferFactoryFromSnapshot(sourceModel.createSnapshot()), this.languageService.create(sourceModelModeId), replacePreviewUri);
this._register(fileMatch.onChange(({ forceUpdateModel }) => this.update(sourceModel, replacePreviewModel, fileMatch, forceUpdateModel)));
this._register(this.searchWorkbenchService.searchModel.onReplaceTermChanged(() => this.update(sourceModel, replacePreviewModel, fileMatch)));
this._register(fileMatch.onDispose(() => replacePreviewModel.dispose())); // TODO@Sandeep we should not dispose a model directly but rather the reference (depends on https://github.com/microsoft/vscode/issues/17073)

Some files were not shown because too many files have changed in this diff Show more