neodisk17 / vscode-ext-flutter-color-viewer

This project help you visualize the colors used in your project.
MIT License
12 stars 4 forks source link

Color picker for any language of choice. #9

Closed lr222gw closed 3 years ago

lr222gw commented 3 years ago

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());
circlecodesolution commented 3 years ago

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