[Bug] Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.

Aperta
#5,491 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@hediet ci sta già lavorando.

Dal 29/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

I'm using 0.57.0 along with monaco-editor-webpack-plugin.

My monaco-editor-webpack-plugin config looks like this:

new MonacoWebpackPlugin({
	languages: ['json', 'html', 'javascript'],
	filename: getFileName('js', 'worker'),
	features: [
		'!caretOperations',
		'!codeAction',
		'!codelens',    // BUG RELATED
		'!colorPicker',
		'!dnd',
		'!gotoSymbol',
		'!linkedEditing',
		'!multicursor',
		'!referenceSearch',
		'!smartSelect',
		'!snippet',
		'!stickyScroll',
		'!toggleHighContrast',
		'!inlineCompletions',
		'!inlineProgress',
	]
})

I create Monaco editors with this config:

export const defaultEditorOptions = {
	minimap: { enabled: false },
	scrollBeyondLastLine: false,
	lineNumbers: 'off',
	renderLineHighlight: 'none',
	selectOnLineNumbers: true,
	automaticLayout: true,
	theme: 'defaultTheme',
	scrollbar: { alwaysConsumeMouseWheel: false },
	renderValidationDecorations: 'on',
	codeLens: false,      // BUG RELATED
};

When I instantiate an editor, it does render on my page but sometimes without styling the text. Furthermore, there are console errors like this. I was previously on 0.52.0 and didn't have this problem. I ran into it while testing the upgrade to 0.57.0.

errors.js:15 Uncaught Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.

Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.
    at InstantiationService._throwIfStrict (instantiationService.js:333:1)
    at InstantiationService._createInstance (instantiationService.js:114:1)
    at InstantiationService.createInstance (instantiationService.js:102:1)
    at CodeEditorContributions._instantiateById (codeEditorContributions.js:120:1)
    at CodeEditorContributions._instantiateSome (codeEditorContributions.js:98:1)
    at eval (codeEditorContributions.js:46:1)
    at InstantiationService._throwIfStrict (instantiationService.js:333:1)
    at InstantiationService._createInstance (instantiationService.js:114:1)
    at InstantiationService.createInstance (instantiationService.js:102:1)
    at CodeEditorContributions._instantiateById (codeEditorContributions.js:120:1)
    at CodeEditorContributions._instantiateSome (codeEditorContributions.js:98:1)
    at eval (codeEditorContributions.js:46:1)
    at eval (errors.js:15:1)

I would expect since I have codeLens disabled in webpack and codeLens disabled on the editor options, that nothing would try to instantiate codeLens! Debugging in my browser, I see "css.editor.codeLens" is the ID trying to create it, which also makes no sense since I never tell Monaco to use CSS:

Image
Monaco Editor Playground Code

Reproduction Steps

No response

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

Lingua principale
JavaScript
Stelle
47k
Fork
4.2k
Merge medio
3g 13h
PR unite (30g)
13

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/monaco-editor

Tutte le issue di microsoft/monaco-editor

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.