From d677a2ee378cc11c2fd2af98d8f1b726ca41e5cc Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 1 Feb 2019 12:17:29 -0600 Subject: [PATCH] Fix gutter icons from extensions --- packages/vscode/src/client.ts | 1 + packages/vscode/src/fill/codeEditor.ts | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 packages/vscode/src/fill/codeEditor.ts diff --git a/packages/vscode/src/client.ts b/packages/vscode/src/client.ts index a94c8e389..fa31b7ea6 100644 --- a/packages/vscode/src/client.ts +++ b/packages/vscode/src/client.ts @@ -5,6 +5,7 @@ import "./fill/storageDatabase"; import "./fill/windowsService"; import "./fill/environmentService"; import "./fill/vscodeTextmate"; +import "./fill/codeEditor"; import { PasteAction } from "./fill/paste"; import "./fill/dom"; import "./vscode.scss"; diff --git a/packages/vscode/src/fill/codeEditor.ts b/packages/vscode/src/fill/codeEditor.ts new file mode 100644 index 000000000..d6a5fbd67 --- /dev/null +++ b/packages/vscode/src/fill/codeEditor.ts @@ -0,0 +1,25 @@ +import { join } from "path"; +import * as editor from "vs/editor/browser/services/codeEditorServiceImpl"; +import { IDecorationRenderOptions } from "vs/editor/common/editorCommon"; + +/** + * This converts icon paths for decorations to the correct URL. + */ +abstract class CodeEditorServiceImpl extends editor.CodeEditorServiceImpl { + + public registerDecorationType(key: string, options: IDecorationRenderOptions, parentTypeKey?: string): void { + super.registerDecorationType(key, options ? { + ...options, + gutterIconPath: options.gutterIconPath && options.gutterIconPath.scheme === "file" ? { + ...options.gutterIconPath, + scheme: location.protocol.replace(":", ""), + authority: location.host, + path: join("/resource", options.gutterIconPath.path), + } :options.gutterIconPath, + } : {}, parentTypeKey); + } + +} + +const target = editor as typeof editor; +target.CodeEditorServiceImpl = CodeEditorServiceImpl;