code-server-2/packages/vscode/src/fill/codeEditor.ts

24 lines
915 B
TypeScript
Raw Normal View History

2019-02-01 18:17:29 +00:00
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;