('markerDecorationsService');
+
+export interface IMarkerDecorationsService {
+ _serviceBrand: any;
+
+ getMarker(model: ITextModel, decoration: IModelDecoration): IMarker | null;
+}
\ No newline at end of file
diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts
index 8cf29738393..183f659fc29 100644
--- a/src/vs/editor/common/services/modelServiceImpl.ts
+++ b/src/vs/editor/common/services/modelServiceImpl.ts
@@ -3,20 +3,14 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { isNonEmptyArray } from 'vs/base/common/arrays';
import { Emitter, Event } from 'vs/base/common/event';
-import { MarkdownString } from 'vs/base/common/htmlContent';
-import { escape } from 'vs/base/common/strings';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
-import * as network from 'vs/base/common/network';
-import { basename } from 'vs/base/common/paths';
import * as platform from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Range } from 'vs/editor/common/core/range';
-import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, IModelDecorationOptions, IModelDeltaDecoration, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model';
-import { ClassName } from 'vs/editor/common/model/intervalTree';
+import { DefaultEndOfLine, EndOfLinePreference, EndOfLineSequence, IIdentifiedSingleEditOperation, ITextBuffer, ITextBufferFactory, ITextModel, ITextModelCreationOptions } from 'vs/editor/common/model';
import { TextModel, createTextBuffer } from 'vs/editor/common/model/textModel';
import { IModelLanguageChangedEvent } from 'vs/editor/common/model/textModelEvents';
import { LanguageIdentifier } from 'vs/editor/common/modes';
@@ -24,10 +18,7 @@ import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegis
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
-import { overviewRulerError, overviewRulerInfo, overviewRulerWarning } from 'vs/editor/common/view/editorColorRegistry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
-import { IMarker, IMarkerService, MarkerSeverity, MarkerTag } from 'vs/platform/markers/common/markers';
-import { ThemeColor, themeColorFromId } from 'vs/platform/theme/common/themeService';
function MODEL_ID(resource: URI): string {
return resource.toString();
@@ -39,7 +30,6 @@ class ModelData implements IDisposable {
private _languageSelection: ILanguageSelection | null;
private _languageSelectionListener: IDisposable | null;
- private _markerDecorations: string[];
private _modelEventListeners: IDisposable[];
constructor(
@@ -52,8 +42,6 @@ class ModelData implements IDisposable {
this._languageSelection = null;
this._languageSelectionListener = null;
- this._markerDecorations = [];
-
this._modelEventListeners = [];
this._modelEventListeners.push(model.onWillDispose(() => onWillDispose(model)));
this._modelEventListeners.push(model.onDidChangeLanguage((e) => onDidChangeLanguage(model, e)));
@@ -71,15 +59,10 @@ class ModelData implements IDisposable {
}
public dispose(): void {
- this._markerDecorations = this.model.deltaDecorations(this._markerDecorations, []);
this._modelEventListeners = dispose(this._modelEventListeners);
this._disposeLanguageSelection();
}
- public acceptMarkerDecorations(newDecorations: IModelDeltaDecoration[]): void {
- this._markerDecorations = this.model.deltaDecorations(this._markerDecorations, newDecorations);
- }
-
public setLanguage(languageSelection: ILanguageSelection): void {
this._disposeLanguageSelection();
this._languageSelection = languageSelection;
@@ -88,155 +71,6 @@ class ModelData implements IDisposable {
}
}
-class ModelMarkerHandler {
-
- public static setMarkers(modelData: ModelData, markerService: IMarkerService): void {
-
- // Limit to the first 500 errors/warnings
- const markers = markerService.read({ resource: modelData.model.uri, take: 500 });
-
- let newModelDecorations: IModelDeltaDecoration[] = markers.map((marker) => {
- return {
- range: ModelMarkerHandler._createDecorationRange(modelData.model, marker),
- options: ModelMarkerHandler._createDecorationOption(marker)
- };
- });
-
- modelData.acceptMarkerDecorations(newModelDecorations);
- }
-
- private static _createDecorationRange(model: ITextModel, rawMarker: IMarker): Range {
-
- let ret = Range.lift(rawMarker);
-
- if (rawMarker.severity === MarkerSeverity.Hint) {
- if (!rawMarker.tags || rawMarker.tags.indexOf(MarkerTag.Unnecessary) === -1) {
- // * never render hints on multiple lines
- // * make enough space for three dots
- ret = ret.setEndPosition(ret.startLineNumber, ret.startColumn + 2);
- }
- }
-
- ret = model.validateRange(ret);
-
- if (ret.isEmpty()) {
- let word = model.getWordAtPosition(ret.getStartPosition());
- if (word) {
- ret = new Range(ret.startLineNumber, word.startColumn, ret.endLineNumber, word.endColumn);
- } else {
- let maxColumn = model.getLineLastNonWhitespaceColumn(ret.startLineNumber) ||
- model.getLineMaxColumn(ret.startLineNumber);
-
- if (maxColumn === 1) {
- // empty line
- // console.warn('marker on empty line:', marker);
- } else if (ret.endColumn >= maxColumn) {
- // behind eol
- ret = new Range(ret.startLineNumber, maxColumn - 1, ret.endLineNumber, maxColumn);
- } else {
- // extend marker to width = 1
- ret = new Range(ret.startLineNumber, ret.startColumn, ret.endLineNumber, ret.endColumn + 1);
- }
- }
- } else if (rawMarker.endColumn === Number.MAX_VALUE && rawMarker.startColumn === 1 && ret.startLineNumber === ret.endLineNumber) {
- let minColumn = model.getLineFirstNonWhitespaceColumn(rawMarker.startLineNumber);
- if (minColumn < ret.endColumn) {
- ret = new Range(ret.startLineNumber, minColumn, ret.endLineNumber, ret.endColumn);
- rawMarker.startColumn = minColumn;
- }
- }
- return ret;
- }
-
- private static _createDecorationOption(marker: IMarker): IModelDecorationOptions {
-
- let className: string;
- let color: ThemeColor | undefined = undefined;
- let zIndex: number;
- let inlineClassName: string | undefined = undefined;
-
- switch (marker.severity) {
- case MarkerSeverity.Hint:
- if (marker.tags && marker.tags.indexOf(MarkerTag.Unnecessary) >= 0) {
- className = ClassName.EditorUnnecessaryDecoration;
- } else {
- className = ClassName.EditorHintDecoration;
- }
- zIndex = 0;
- break;
- case MarkerSeverity.Warning:
- className = ClassName.EditorWarningDecoration;
- color = themeColorFromId(overviewRulerWarning);
- zIndex = 20;
- break;
- case MarkerSeverity.Info:
- className = ClassName.EditorInfoDecoration;
- color = themeColorFromId(overviewRulerInfo);
- zIndex = 10;
- break;
- case MarkerSeverity.Error:
- default:
- className = ClassName.EditorErrorDecoration;
- color = themeColorFromId(overviewRulerError);
- zIndex = 30;
- break;
- }
-
- if (marker.tags) {
- if (marker.tags.indexOf(MarkerTag.Unnecessary) !== -1) {
- inlineClassName = ClassName.EditorUnnecessaryInlineDecoration;
- }
- }
-
- let hoverMessage: MarkdownString | null = null;
- let { message, source, relatedInformation, code } = marker;
-
- if (typeof message === 'string') {
-
- hoverMessage = new MarkdownString();
- // Disable markdown renderer sanitize to allow html
- // Hence, escape all input strings
- hoverMessage.sanitize = false;
-
- hoverMessage.appendMarkdown(``);
- hoverMessage.appendMarkdown(`${escape(message.trim())}`);
- if (source) {
- hoverMessage.appendMarkdown(`${escape(source)}`);
- if (code) {
- hoverMessage.appendMarkdown(`(${escape(code)})`);
- }
- } else if (code) {
- hoverMessage.appendMarkdown(`(${escape(code)})`);
- }
- hoverMessage.appendMarkdown(`
`);
-
- if (isNonEmptyArray(relatedInformation)) {
- hoverMessage.appendMarkdown(``);
- for (const { message, resource, startLineNumber, startColumn } of relatedInformation) {
- hoverMessage.appendMarkdown(`- `);
- hoverMessage.appendMarkdown(`${escape(basename(resource.path))}(${startLineNumber}, ${startColumn})`);
- hoverMessage.appendMarkdown(`: ${escape(message)}`);
- hoverMessage.appendMarkdown(`
`);
- }
- hoverMessage.appendMarkdown(`
`);
- }
- }
-
- return {
- stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
- className,
- hoverMessage,
- showIfCollapsed: true,
- overviewRuler: {
- color,
- position: OverviewRulerLane.Right
- },
- zIndex,
- inlineClassName,
- };
- }
-}
-
interface IRawEditorConfig {
tabSize?: any;
insertSpaces?: any;
@@ -256,8 +90,6 @@ const DEFAULT_EOL = (platform.isLinux || platform.isMacintosh) ? DefaultEndOfLin
export class ModelServiceImpl extends Disposable implements IModelService {
public _serviceBrand: any;
- private _markerService: IMarkerService | null;
- private _markerServiceSubscription: IDisposable;
private _configurationService: IConfigurationService;
private _configurationServiceSubscription: IDisposable;
private _resourcePropertiesService: ITextResourcePropertiesService;
@@ -281,22 +113,15 @@ export class ModelServiceImpl extends Disposable implements IModelService {
private _models: { [modelId: string]: ModelData; };
constructor(
- @IMarkerService markerService: IMarkerService | null,
@IConfigurationService configurationService: IConfigurationService,
- @ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService,
+ @ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService
) {
super();
- this._markerService = markerService;
this._configurationService = configurationService;
this._resourcePropertiesService = resourcePropertiesService;
this._models = {};
this._modelCreationOptionsByLanguageAndResource = Object.create(null);
- if (this._markerService) {
- this._markerServiceSubscription = this._markerService.onMarkerChanged(this._handleMarkerChange, this);
- this._handleMarkerChange(this._markerService.read().map(m => m.resource));
- }
-
this._configurationServiceSubscription = this._configurationService.onDidChangeConfiguration(e => this._updateModelOptions());
this._updateModelOptions();
}
@@ -406,38 +231,10 @@ export class ModelServiceImpl extends Disposable implements IModelService {
}
public dispose(): void {
- if (this._markerServiceSubscription) {
- this._markerServiceSubscription.dispose();
- }
this._configurationServiceSubscription.dispose();
super.dispose();
}
- private _handleMarkerChange(changedResources: URI[]): void {
- changedResources.forEach((resource) => {
- let modelId = MODEL_ID(resource);
- let modelData = this._models[modelId];
- if (!modelData) {
- return;
- }
- ModelMarkerHandler.setMarkers(modelData, this._markerService!);
- });
- }
-
- private _cleanUp(model: ITextModel): void {
- // clean up markers for internal, transient models
- if (model.uri.scheme === network.Schemas.inMemory
- || model.uri.scheme === network.Schemas.internal
- || model.uri.scheme === network.Schemas.vscode) {
- if (this._markerService) {
- this._markerService.read({ resource: model.uri }).map(marker => marker.owner).forEach(owner => this._markerService!.remove(owner, [model.uri]));
- }
- }
-
- // clean up cache
- delete this._modelCreationOptionsByLanguageAndResource[model.getLanguageIdentifier().language + model.uri];
- }
-
// --- begin IModelService
private _createModelData(value: string | ITextBufferFactory, languageIdentifier: LanguageIdentifier, resource: URI | null | undefined, isForSimpleWidget: boolean): ModelData {
@@ -541,11 +338,6 @@ export class ModelServiceImpl extends Disposable implements IModelService {
modelData = this._createModelData(value, PLAINTEXT_LANGUAGE_IDENTIFIER, resource, isForSimpleWidget);
}
- // handle markers (marker service => model)
- if (this._markerService) {
- ModelMarkerHandler.setMarkers(modelData, this._markerService);
- }
-
this._onModelAdded.fire(modelData.model);
return modelData.model;
@@ -601,7 +393,9 @@ export class ModelServiceImpl extends Disposable implements IModelService {
delete this._models[modelId];
modelData.dispose();
- this._cleanUp(model);
+ // clean up cache
+ delete this._modelCreationOptionsByLanguageAndResource[model.getLanguageIdentifier().language + model.uri];
+
this._onModelRemoved.fire(model);
}
diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts
index 5a2f1b51188..d729d098ccc 100644
--- a/src/vs/editor/contrib/hover/hover.ts
+++ b/src/vs/editor/contrib/hover/hover.ts
@@ -24,6 +24,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorHoverBackground, editorHoverBorder, editorHoverHighlight, textCodeBlockBackground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
+import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
export class ModesHoverController implements IEditorContribution {
@@ -61,6 +62,7 @@ export class ModesHoverController implements IEditorContribution {
constructor(private readonly _editor: ICodeEditor,
@IOpenerService private readonly _openerService: IOpenerService,
@IModeService private readonly _modeService: IModeService,
+ @IMarkerDecorationsService private readonly _markerDecorationsService: IMarkerDecorationsService,
@IThemeService private readonly _themeService: IThemeService
) {
this._toUnhook = [];
@@ -204,7 +206,7 @@ export class ModesHoverController implements IEditorContribution {
private _createHoverWidget() {
const renderer = new MarkdownRenderer(this._editor, this._modeService, this._openerService);
- this._contentWidget = new ModesContentHoverWidget(this._editor, renderer, this._themeService);
+ this._contentWidget = new ModesContentHoverWidget(this._editor, renderer, this._markerDecorationsService, this._themeService);
this._glyphWidget = new ModesGlyphHoverWidget(this._editor, renderer);
}
diff --git a/src/vs/editor/contrib/hover/modesContentHover.ts b/src/vs/editor/contrib/hover/modesContentHover.ts
index 1a37b64e5fd..94e66e196e4 100644
--- a/src/vs/editor/contrib/hover/modesContentHover.ts
+++ b/src/vs/editor/contrib/hover/modesContentHover.ts
@@ -13,7 +13,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { Position } from 'vs/editor/common/core/position';
import { IRange, Range } from 'vs/editor/common/core/range';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
-import { DocumentColorProvider, Hover, HoverProviderRegistry, IColor } from 'vs/editor/common/modes';
+import { DocumentColorProvider, Hover as MarkdownHover, HoverProviderRegistry, IColor } from 'vs/editor/common/modes';
import { getColorPresentations } from 'vs/editor/contrib/colorPicker/color';
import { ColorDetector } from 'vs/editor/contrib/colorPicker/colorDetector';
import { ColorPickerModel } from 'vs/editor/contrib/colorPicker/colorPickerModel';
@@ -23,7 +23,10 @@ import { HoverOperation, HoverStartMode, IHoverComputer } from 'vs/editor/contri
import { ContentHoverWidget } from 'vs/editor/contrib/hover/hoverWidgets';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
import { IThemeService } from 'vs/platform/theme/common/themeService';
-import { coalesce } from 'vs/base/common/arrays';
+import { coalesce, isNonEmptyArray } from 'vs/base/common/arrays';
+import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers';
+import { basename } from 'vs/base/common/paths';
+import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
const $ = dom.$;
@@ -36,7 +39,15 @@ class ColorHover {
) { }
}
-type HoverPart = Hover | ColorHover;
+class MarkerHover {
+
+ constructor(
+ public readonly range: IRange,
+ public readonly marker: IMarker,
+ ) { }
+}
+
+type HoverPart = MarkdownHover | ColorHover | MarkerHover;
class ModesContentComputer implements IHoverComputer {
@@ -44,7 +55,10 @@ class ModesContentComputer implements IHoverComputer {
private _result: HoverPart[];
private _range: Range | null;
- constructor(editor: ICodeEditor) {
+ constructor(
+ editor: ICodeEditor,
+ private _markerDecorationsService: IMarkerDecorationsService
+ ) {
this._editor = editor;
this._range = null;
}
@@ -80,6 +94,7 @@ class ModesContentComputer implements IHoverComputer {
return [];
}
+ const model = this._editor.getModel();
const lineNumber = this._range.startLineNumber;
if (lineNumber > this._editor.getModel().getLineCount()) {
@@ -88,7 +103,7 @@ class ModesContentComputer implements IHoverComputer {
}
const colorDetector = ColorDetector.get(this._editor);
- const maxColumn = this._editor.getModel().getLineMaxColumn(lineNumber);
+ const maxColumn = model.getLineMaxColumn(lineNumber);
const lineDecorations = this._editor.getLineDecorations(lineNumber);
let didFindColor = false;
@@ -102,6 +117,11 @@ class ModesContentComputer implements IHoverComputer {
}
const range = new Range(hoverRange.startLineNumber, startColumn, hoverRange.startLineNumber, endColumn);
+ const marker = this._markerDecorationsService.getMarker(model, d);
+ if (marker) {
+ return new MarkerHover(range, marker);
+ }
+
const colorData = colorDetector.getColorData(d.range.getStartPosition());
if (!didFindColor && colorData) {
@@ -182,13 +202,14 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
constructor(
editor: ICodeEditor,
markdownRenderer: MarkdownRenderer,
+ markerDecorationsService: IMarkerDecorationsService,
private readonly _themeService: IThemeService
) {
super(ModesContentHoverWidget.ID, editor);
this._messages = [];
this._lastRange = null;
- this._computer = new ModesContentComputer(this._editor);
+ this._computer = new ModesContentComputer(this._editor, markerDecorationsService);
this._highlightDecorations = [];
this._isChangingDecorations = false;
@@ -328,16 +349,7 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
renderColumn = Math.min(renderColumn, msg.range.startColumn);
highlightRange = highlightRange ? Range.plusRange(highlightRange, msg.range) : Range.lift(msg.range);
- if (!(msg instanceof ColorHover)) {
- msg.contents
- .filter(contents => !isEmptyMarkdownString(contents))
- .forEach(contents => {
- const renderedContents = this._markdownRenderer.render(contents);
- markdownDisposeable = renderedContents;
- fragment.appendChild($('div.hover-row', undefined, renderedContents.element));
- isEmptyHoverContent = false;
- });
- } else {
+ if (msg instanceof ColorHover) {
containColorPicker = true;
const { red, green, blue, alpha } = msg.color;
@@ -420,6 +432,20 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this.renderDisposable = combinedDisposable([colorListener, colorChangeListener, widget, markdownDisposeable]);
});
+ } else {
+ if (msg instanceof MarkerHover) {
+ isEmptyHoverContent = false;
+ fragment.appendChild($('div.hover-row', undefined, this.renderMarkerHover(msg)));
+ } else {
+ msg.contents
+ .filter(contents => !isEmptyMarkdownString(contents))
+ .forEach(contents => {
+ const renderedContents = this._markdownRenderer.render(contents);
+ markdownDisposeable = renderedContents;
+ fragment.appendChild($('div.hover-row', undefined, renderedContents.element));
+ isEmptyHoverContent = false;
+ });
+ }
}
});
@@ -438,6 +464,36 @@ export class ModesContentHoverWidget extends ContentHoverWidget {
this._isChangingDecorations = false;
}
+ private renderMarkerHover(markerHover: MarkerHover): HTMLElement {
+ const hoverElement = $('div');
+ const { source, message, code, relatedInformation } = markerHover.marker;
+
+ const messageElement = dom.append(hoverElement, $('span'));
+ messageElement.style.whiteSpace = 'pre-wrap';
+ messageElement.innerText = message.trim();
+ this._editor.applyFontInfo(messageElement);
+
+ if (source || code) {
+ const detailsElement = dom.append(hoverElement, $('span'));
+ detailsElement.style.opacity = '0.6';
+ detailsElement.style.paddingLeft = '6px';
+ detailsElement.innerText = source && code ? `${source}(${code})` : `(${code})`;
+ }
+
+ if (isNonEmptyArray(relatedInformation)) {
+ const listElement = dom.append(hoverElement, $('ul'));
+ for (const { message, resource, startLineNumber, startColumn } of relatedInformation) {
+ const item = dom.append(listElement, $('li'));
+ const a = dom.append(item, $('a'));
+ a.setAttribute('data-href', `${resource.toString(false)}#${startLineNumber},${startColumn}`);
+ a.innerText = `${basename(resource.path)}(${startLineNumber}, ${startColumn})`;
+ const messageElement = dom.append(item, $('span'));
+ messageElement.innerText = `: ${message}`;
+ }
+ }
+ return hoverElement;
+ }
+
private static readonly _DECORATION_OPTIONS = ModelDecorationOptions.register({
className: 'hoverHighlight'
});
@@ -450,10 +506,13 @@ function hoverContentsEquals(first: HoverPart[], second: HoverPart[]): boolean {
for (let i = 0; i < first.length; i++) {
const firstElement = first[i];
const secondElement = second[i];
- if (firstElement instanceof ColorHover) {
+ if (firstElement instanceof MarkerHover && secondElement instanceof MarkerHover) {
+ return IMarkerData.makeKey(firstElement.marker) === IMarkerData.makeKey(secondElement.marker);
+ }
+ if (firstElement instanceof ColorHover || secondElement instanceof ColorHover) {
return false;
}
- if (secondElement instanceof ColorHover) {
+ if (firstElement instanceof MarkerHover || secondElement instanceof MarkerHover) {
return false;
}
if (!markedStringsEquals(firstElement.contents, secondElement.contents)) {
diff --git a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
index 024eff33391..164a2314fed 100644
--- a/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
+++ b/src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
@@ -15,7 +15,6 @@ import { javascriptOnEnterRules } from 'vs/editor/test/common/modes/supports/jav
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { isLinux, isMacintosh } from 'vs/base/common/platform';
-import { MarkerService } from 'vs/platform/markers/common/markerService';
import { BracketSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/bracketSelections';
import { provideSelectionRanges } from 'vs/editor/contrib/smartSelect/smartSelect';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -66,7 +65,7 @@ suite('SmartSelect', () => {
setup(() => {
const configurationService = new TestConfigurationService();
- modelService = new ModelServiceImpl(new MarkerService(), configurationService, new TestTextResourcePropertiesService(configurationService));
+ modelService = new ModelServiceImpl(configurationService, new TestTextResourcePropertiesService(configurationService));
mode = new MockJSMode();
});
diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts
index fa8461b4b37..0255ecc1d94 100644
--- a/src/vs/editor/standalone/browser/standaloneServices.ts
+++ b/src/vs/editor/standalone/browser/standaloneServices.ts
@@ -42,6 +42,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { MenuService } from 'vs/platform/actions/common/menuService';
+import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
+import { MarkerDecorationsService } from 'vs/editor/common/services/markerDecorationsServiceImpl';
export interface IEditorOverrideServices {
[index: string]: any;
@@ -133,7 +135,9 @@ export module StaticServices {
export const modeService = define(IModeService, (o) => new ModeServiceImpl());
- export const modelService = define(IModelService, (o) => new ModelServiceImpl(markerService.get(o), configurationService.get(o), resourcePropertiesService.get(o)));
+ export const modelService = define(IModelService, (o) => new ModelServiceImpl(configurationService.get(o), resourcePropertiesService.get(o)));
+
+ export const markerDecorationsService = define(IMarkerDecorationsService, (o) => new MarkerDecorationsService(modelService.get(o), markerService.get(o)));
export const editorWorkerService = define(IEditorWorkerService, (o) => new EditorWorkerServiceImpl(modelService.get(o), resourceConfigurationService.get(o)));
diff --git a/src/vs/editor/test/common/services/modelService.test.ts b/src/vs/editor/test/common/services/modelService.test.ts
index 47064c5c04b..739c8f48197 100644
--- a/src/vs/editor/test/common/services/modelService.test.ts
+++ b/src/vs/editor/test/common/services/modelService.test.ts
@@ -27,7 +27,7 @@ suite('ModelService', () => {
configService.setUserConfiguration('files', { 'eol': '\n' });
configService.setUserConfiguration('files', { 'eol': '\r\n' }, URI.file(platform.isWindows ? 'c:\\myroot' : '/myroot'));
- modelService = new ModelServiceImpl(null, configService, new TestTextResourcePropertiesService(configService));
+ modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService));
});
teardown(() => {
diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts
index 4db5b14227f..564fad93637 100644
--- a/src/vs/workbench/electron-browser/shell.ts
+++ b/src/vs/workbench/electron-browser/shell.ts
@@ -104,6 +104,8 @@ import { TextResourcePropertiesService } from 'vs/workbench/services/textfile/el
import { MultiExtensionManagementService } from 'vs/platform/extensionManagement/node/multiExtensionManagement';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-browser/remoteAuthorityResolverService';
+import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
+import { MarkerDecorationsService } from 'vs/editor/common/services/markerDecorationsServiceImpl';
/**
* Services that we require for the Shell
@@ -488,6 +490,7 @@ export class WorkbenchShell extends Disposable {
serviceCollection.set(IMarkerService, new SyncDescriptor(MarkerService, undefined, true));
+
serviceCollection.set(IModeService, new SyncDescriptor(WorkbenchModeServiceImpl));
serviceCollection.set(ITextResourceConfigurationService, new SyncDescriptor(TextResourceConfigurationService));
@@ -496,6 +499,8 @@ export class WorkbenchShell extends Disposable {
serviceCollection.set(IModelService, new SyncDescriptor(ModelServiceImpl, undefined, true));
+ serviceCollection.set(IMarkerDecorationsService, new SyncDescriptor(MarkerDecorationsService));
+
serviceCollection.set(IEditorWorkerService, new SyncDescriptor(EditorWorkerServiceImpl));
serviceCollection.set(IUntitledEditorService, new SyncDescriptor(UntitledEditorService, undefined, true));
diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
index db354cb993b..6b0abfd5d04 100644
--- a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
+++ b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
@@ -42,7 +42,7 @@ suite('MainThreadDocumentsAndEditors', () => {
deltas.length = 0;
const configService = new TestConfigurationService();
configService.setUserConfiguration('editor', { 'detectIndentation': false });
- modelService = new ModelServiceImpl(null, configService, new TestTextResourcePropertiesService(configService));
+ modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService));
codeEditorService = new TestCodeEditorService();
textFileService = new class extends mock() {
isDirty() { return false; }
diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
index f0e87f04c69..0869f481294 100644
--- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
+++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
@@ -41,7 +41,7 @@ suite('MainThreadEditors', () => {
setup(() => {
const configService = new TestConfigurationService();
- modelService = new ModelServiceImpl(null, configService, new TestTextResourcePropertiesService(configService));
+ modelService = new ModelServiceImpl(configService, new TestTextResourcePropertiesService(configService));
const codeEditorService = new TestCodeEditorService();
movedResources.clear();
diff --git a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
index 53897a88dfa..2102637ea09 100644
--- a/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
+++ b/src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
@@ -72,7 +72,7 @@ suite.skip('QuickOpen performance (integration)', () => {
[ITelemetryService, telemetryService],
[IConfigurationService, configurationService],
[ITextResourcePropertiesService, textResourcePropertiesService],
- [IModelService, new ModelServiceImpl(null, configurationService, textResourcePropertiesService)],
+ [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService)],
[IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))],
[IEditorService, new TestEditorService()],
[IEditorGroupsService, new TestEditorGroupsService()],
diff --git a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
index 61591b0584c..31cc900cda4 100644
--- a/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
+++ b/src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
@@ -62,7 +62,7 @@ suite.skip('TextSearch performance (integration)', () => {
[ITelemetryService, telemetryService],
[IConfigurationService, configurationService],
[ITextResourcePropertiesService, textResourcePropertiesService],
- [IModelService, new ModelServiceImpl(null, configurationService, textResourcePropertiesService)],
+ [IModelService, new ModelServiceImpl(configurationService, textResourcePropertiesService)],
[IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))],
[IEditorService, new TestEditorService()],
[IEditorGroupsService, new TestEditorGroupsService()],