monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

How to use "showUnused" editor option?

Open yln99517 opened this issue 8 years ago • 5 comments

I tried the following snippet in the playground. but there is no fading for unused variable.

monaco.editor.create(document.getElementById("container"), {
	value: "function hello() {\n\tvar d;\n\talert('Hello world!');\n}",
	language: "typescript",
    showUnused: true
});

any working samples?

yln99517 avatar Aug 13 '18 19:08 yln99517

This setting turns on the UI side of things. We also would need some language implementation to provide such diagnostics/markers. AFAIK none of the built-in languages provide "unused" diagnostics/markers.

alexdima avatar Aug 14 '18 08:08 alexdima

Using the typescript language server with the tsconfig setting noUnusedLocals, we do get red squiggles, so how would one map that to the showUnused feature?

zewa666 avatar Sep 10 '18 09:09 zewa666

@zewa666 I think some work is needed in monaco-typescript here or here to create the diagnostics not as errors, but as warnings or hints.

alexdima avatar Sep 13 '18 09:09 alexdima

@alexandrudima thanks for pointing that out. Is there an existing issue for that which we can track?

zewa666 avatar Sep 13 '18 13:09 zewa666

@zewa666 I don't think there is any issue to track specifically this. We keep issues for monaco-typescript in this repo with the label monaco-typescript.

alexdima avatar Sep 13 '18 15:09 alexdima