wip: Color provider implementation start for Joao

This commit is contained in:
Michel Kaporin
2017-07-26 16:25:58 +02:00
parent bff962675d
commit 5770dd4287

View File

@@ -6,7 +6,7 @@
import * as path from 'path';
import { languages, window, commands, workspace, ExtensionContext } from 'vscode';
import { languages, window, commands, workspace, ExtensionContext, DocumentColorProvider, CancellationToken, TextDocument, ProviderResult, ColorInfo } from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, RequestType, Range, TextEdit } from 'vscode-languageclient';
import { activateColorDecorations } from './colorDecorators';
@@ -33,8 +33,9 @@ export function activate(context: ExtensionContext) {
};
// Options to control the language client
const documentSelector = ['css', 'less', 'scss'];
let clientOptions: LanguageClientOptions = {
documentSelector: ['css', 'less', 'scss'],
documentSelector: documentSelector,
synchronize: {
configurationSection: ['css', 'scss', 'less']
},
@@ -59,6 +60,18 @@ export function activate(context: ExtensionContext) {
};
disposable = activateColorDecorations(colorRequestor, { css: true, scss: true, less: true }, isDecoratorEnabled);
context.subscriptions.push(disposable);
languages.registerColorProvider(documentSelector, <DocumentColorProvider>{
provideDocumentColors(document: TextDocument, token: CancellationToken): ProviderResult<ColorInfo[]> {
const colorInfos: ColorInfo[] = [];
colorRequestor(document.uri.toString()).then(ranges => {
ranges.forEach(range => {
colorInfos.push(new ColorInfo(undefined, undefined, '', []));
});
});
return colorInfos;
}
});
});
let indentationRules = {