Add Codelens using theia extension

Hi All,

I am looking for an example for monaco.languages.CodeLensProvider , I found an example using theia plugins api , but I am not able to mock the same in theia extension.

che-theia-samples/code-lens-provider-plugin-frontend-plugin.ts at master · eclipse/che-theia-samples (

Could someone point me to an example?


@chakraborty-slx thank you for the discussion, I don’t believe there is any official example for using the provider from the point of a theia extension, but it does remind me of an issue this week which may help as an example:

I have not tested the extension myself however.

thanks @vince-fugnitto , yes the example is helpful.

1 Like

Excuse me, can I ask a question?
I use the following code in frontend-module of theia extension.
However, sometimes it takes effect, sometimes it does not.

import * as monaco from '@theia/monaco-editor-core';

monaco.languages.registerCodeLensProvider('json', {
    // eslint-disable-next-line @typescript-eslint/tslint/config
    provideCodeLenses: function () {
        return {
            lenses: [
                    range: {
                        startLineNumber: 1,
                        startColumn: 1,
                        endLineNumber: 2,
                        endColumn: 1,
                    id: 'setting33',
                    command: {
                        id: 'setting33',
                        title: '配置',
            dispose: () => {},