Considers showIfCollapsed for injected text decorations.

上级 dd01064f
......@@ -3267,13 +3267,13 @@ class DecorationsTrees {
public getInjectedTextInInterval(host: IDecorationsTreesHost, start: number, end: number, filterOwnerId: number): model.IModelDecoration[] {
const versionId = host.getVersionId();
const result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, versionId);
return this._ensureNodesHaveRanges(host, result);
return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());
}
public getAllInjectedText(host: IDecorationsTreesHost, filterOwnerId: number): model.IModelDecoration[] {
const versionId = host.getVersionId();
const result = this._injectedTextDecorationsTree.search(filterOwnerId, false, versionId);
return this._ensureNodesHaveRanges(host, result);
return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());
}
public getAll(host: IDecorationsTreesHost, filterOwnerId: number, filterOutValidation: boolean, overviewRulerOnly: boolean): model.IModelDecoration[] {
......
......@@ -283,7 +283,8 @@ class DecorationsWidget implements IDisposable {
range: Range.fromPositions(new Position(lineNumber, p.column)),
options: shouldUseInjectedText ? {
description: 'ghost-text',
after: { content: contentText, inlineClassName: p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration' }
after: { content: contentText, inlineClassName: p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration' },
showIfCollapsed: true,
} : {
...decorationType.resolve()
}
......
......@@ -35,6 +35,7 @@ suite('Editor Model - Injected Text Events', () => {
options: {
after: { content: 'injected1' },
description: 'test1',
showIfCollapsed: true
},
range: new Range(1, 1, 1, 1),
}]);
......@@ -51,12 +52,14 @@ suite('Editor Model - Injected Text Events', () => {
options: {
after: { content: 'injected1' },
description: 'test1',
showIfCollapsed: true
},
range: new Range(2, 1, 2, 1),
}, {
options: {
after: { content: 'injected2' },
description: 'test2',
showIfCollapsed: true
},
range: new Range(2, 2, 2, 2),
}]);
......
......@@ -746,7 +746,8 @@ suite('SplitLinesCollection', () => {
description: 'example',
after: {
content: 'very very long injected text that causes a line break'
}
},
showIfCollapsed: true,
}
}]);
......
......@@ -310,7 +310,8 @@ suite('ViewModel', () => {
description: 'test',
before: {
content: 'bar'
}
},
showIfCollapsed: true
}
},
{
......@@ -319,7 +320,8 @@ suite('ViewModel', () => {
description: 'test',
before: {
content: 'bz'
}
},
showIfCollapsed: true
}
},
]);
......
......@@ -754,6 +754,7 @@ class TestMessageDecoration implements ITestDecoration {
content: renderStringAsPlaintext(message),
inlineClassName: `test-message-inline-content test-message-inline-content-s${severity} ${this.contentIdClass}`
};
options.showIfCollapsed = true;
const rulerColor = severity === TestMessageType.Error
? overviewRulerError
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册