mirror of
https://github.com/kiteco/vscode-plugin.git
synced 2024-08-17 20:00:43 +03:00
Clear Decoration on Disable (#379)
* fix: always clear decoration when not enabled * fix: enableLineDecoration test
This commit is contained in:
parent
1aae18715b
commit
954ae979fb
@ -19,7 +19,7 @@ import {
|
||||
|
||||
import * as KiteAPI from "kite-api";
|
||||
|
||||
const relatedCodeLineDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
|
||||
export const relatedCodeLineDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
|
||||
rangeBehavior: DecorationRangeBehavior.ClosedOpen,
|
||||
});
|
||||
|
||||
@ -58,6 +58,7 @@ export default class KiteRelatedCodeDecorationsProvider {
|
||||
// Public for testing
|
||||
public async onDidChangeTextEditorSelection(event: TextEditorSelectionChangeEvent): Promise<void> {
|
||||
if (!this.enabled()) {
|
||||
this.clearDecorations(event.textEditor)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import * as KiteAPI from 'kite-api';
|
||||
import KiteRelatedCodeDecorationsProvider from '../src/codenav-decoration';
|
||||
import KiteRelatedCodeDecorationsProvider, { relatedCodeLineDecoration } from '../src/codenav-decoration';
|
||||
|
||||
describe('KiteRelatedCodeDecorationsProvider', () => {
|
||||
|
||||
@ -66,7 +66,7 @@ describe('KiteRelatedCodeDecorationsProvider', () => {
|
||||
await fireEvent();
|
||||
|
||||
assert.isFalse(getLineDecorationStub.called);
|
||||
assert.isFalse(setDecorationSpy.called);
|
||||
assert.isTrue(setDecorationSpy.calledWith(relatedCodeLineDecoration, []), "clears the decoration when disabled");
|
||||
|
||||
getConfigurationStub.restore();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user