aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/notifications
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-08 20:39:52 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-08 20:39:52 +0100
commitf4ad36e972989c3feed8671d6d6fca0aed37cd8f (patch)
treef60e1aa4703c3e176315ecd886206848028b8cbf /editors/code/src/notifications
parenta05e09e9c514878148ddf26aa76d6b9183583d0f (diff)
parentbbf38b9e722e8d6455828ff22242c92219da346d (diff)
Merge #103
103: WIP: refactor vscode extension r=aochagavia a=aochagavia Todo: - [x] Add more comments, so other people can find their way in the codebase - [x] Resolve remaining tslint suggestions - [ ] Integrate with CI @matklad The standard configuration of tslint forbids using `console.log` and `console.error`. Is there any reason we are using those or can I remove them? If they are used for debugging purposes I would prefer to remove them and rely on vscode's excellent debugger. Co-authored-by: Adolfo OchagavĂ­a <[email protected]>
Diffstat (limited to 'editors/code/src/notifications')
-rw-r--r--editors/code/src/notifications/index.ts5
-rw-r--r--editors/code/src/notifications/publish_decorations.ts20
2 files changed, 25 insertions, 0 deletions
diff --git a/editors/code/src/notifications/index.ts b/editors/code/src/notifications/index.ts
new file mode 100644
index 000000000..c56576865
--- /dev/null
+++ b/editors/code/src/notifications/index.ts
@@ -0,0 +1,5 @@
1import * as publishDecorations from './publish_decorations';
2
3export {
4 publishDecorations,
5};
diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts
new file mode 100644
index 000000000..d8790386b
--- /dev/null
+++ b/editors/code/src/notifications/publish_decorations.ts
@@ -0,0 +1,20 @@
1import * as vscode from 'vscode';
2
3import { Decoration } from '../highlighting';
4import { Server } from '../server';
5
6export interface PublishDecorationsParams {
7 uri: string;
8 decorations: Decoration[];
9}
10
11export function handle(params: PublishDecorationsParams) {
12 const targetEditor = vscode.window.visibleTextEditors.find(
13 (editor) => editor.document.uri.toString() === params.uri,
14 );
15 if (!Server.config.highlightingOn || !targetEditor) { return; }
16 Server.highlighter.setHighlights(
17 targetEditor,
18 params.decorations,
19 );
20}