neodisk17/vscode-ext-flutter-color-viewer

Color picker for any language of choice.

lr222gw opened this issue · 1 comments

It would be great if the colorviewer / colorpicker worked for any language.

I noticed it worked great with json, but not with cs-files (for csharp...).
I managed to get it working for C# by tweaking the exttension.js, not sure if I caused any damage but this is what I did:

function activate(context) {
    // Use the console to output diagnostic information (console.log) and errors (console.error)
    // This line of code will only be executed once when your extension is activated
    let docFlutterSelector = {
        pattern: "**/*.dart"
    };
    // Register our CodeLens provider
    let FlutterColorShowDisposable = vscode.languages.registerColorProvider(docFlutterSelector, new FlutterColorShow_1.default());
    let docJsonSelector = {
        pattern: "**/*.json",
    };
    // Register our CodeLens provider
    let JSONColorShowDisposable = vscode.languages.registerColorProvider(docJsonSelector, new JSONColorShow_1.default());

    let docCSharpSelector = {
        pattern: "**/*.cs",
    };
    vscode.languages.registerColorProvider(docCSharpSelector, new JSONColorShow_1.default());

    context.subscriptions.push(FlutterColorShowDisposable);
    context.subscriptions.push(JSONColorShowDisposable);
}

i.e. I just added the following lines:

let docCSharpSelector = {
    pattern: "**/*.cs",
};
vscode.languages.registerColorProvider(docCSharpSelector, new JSONColorShow_1.default());

Hi @lr222gw,
We have now added support for all the languages.
Sorry for the delay, We were a bit busy

You can now enjoy it in the CSharp file