mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Rename mode to language
This commit is contained in:
@@ -1224,7 +1224,7 @@ export interface IModelAddedData {
|
||||
isDirty: boolean;
|
||||
}
|
||||
export interface ExtHostDocumentsShape {
|
||||
$acceptModelModeChanged(strURL: UriComponents, newModeId: string): void;
|
||||
$acceptModelLanguageChanged(strURL: UriComponents, newLanguageId: string): void;
|
||||
$acceptModelSaved(strURL: UriComponents): void;
|
||||
$acceptDirtyStateChanged(strURL: UriComponents, isDirty: boolean): void;
|
||||
$acceptModelChanged(strURL: UriComponents, e: IModelChangedEvent, isDirty: boolean): void;
|
||||
|
||||
@@ -14,17 +14,17 @@ import { EndOfLine, Position, Range } from 'vs/workbench/api/common/extHostTypes
|
||||
import type * as vscode from 'vscode';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
|
||||
const _modeId2WordDefinition = new Map<string, RegExp>();
|
||||
const _languageId2WordDefinition = new Map<string, RegExp>();
|
||||
export function setWordDefinitionFor(languageId: string, wordDefinition: RegExp | undefined): void {
|
||||
if (!wordDefinition) {
|
||||
_modeId2WordDefinition.delete(languageId);
|
||||
_languageId2WordDefinition.delete(languageId);
|
||||
} else {
|
||||
_modeId2WordDefinition.set(languageId, wordDefinition);
|
||||
_languageId2WordDefinition.set(languageId, wordDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
export function getWordDefinitionFor(languageId: string): RegExp | undefined {
|
||||
return _modeId2WordDefinition.get(languageId);
|
||||
return _languageId2WordDefinition.get(languageId);
|
||||
}
|
||||
|
||||
export class ExtHostDocumentData extends MirrorTextModel {
|
||||
|
||||
@@ -103,7 +103,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
return this._proxy.$tryCreateDocument(options).then(data => URI.revive(data));
|
||||
}
|
||||
|
||||
public $acceptModelModeChanged(uriComponents: UriComponents, newModeId: string): void {
|
||||
public $acceptModelLanguageChanged(uriComponents: UriComponents, newLanguageId: string): void {
|
||||
const uri = URI.revive(uriComponents);
|
||||
const data = this._documentsAndEditors.getDocument(uri);
|
||||
if (!data) {
|
||||
@@ -112,7 +112,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
|
||||
// Treat a mode change as a remove + add
|
||||
|
||||
this._onDidRemoveDocument.fire(data.document);
|
||||
data._acceptLanguageId(newModeId);
|
||||
data._acceptLanguageId(newLanguageId);
|
||||
this._onDidAddDocument.fire(data.document);
|
||||
}
|
||||
|
||||
|
||||
@@ -347,10 +347,10 @@ export class ExtHostNotebookDocument {
|
||||
this._emitter.emitCellOutputsChange(deepFreeze({ document: this.apiNotebook, cells: [cell.apiCell] }));
|
||||
}
|
||||
|
||||
private _changeCellLanguage(index: number, newModeId: string): void {
|
||||
private _changeCellLanguage(index: number, newLanguageId: string): void {
|
||||
const cell = this._cells[index];
|
||||
if (cell.apiCell.document.languageId !== newModeId) {
|
||||
this._textDocuments.$acceptModelModeChanged(cell.uri, newModeId);
|
||||
if (cell.apiCell.document.languageId !== newLanguageId) {
|
||||
this._textDocuments.$acceptModelLanguageChanged(cell.uri, newLanguageId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user