TypeFox / monaco-components

Monaco Editor and Language Client Wrapper, plus Monaco Editor React Component
MIT License
42 stars 13 forks source link

MonacoEditorReactComp + registerFileSystemOverlay #57

Closed cdietrich closed 9 months ago

cdietrich commented 10 months ago

Hi, i am trying to get the MonacoEditorReactComp combined with registerFileSystemOverlay in order to have library files available for referencing in the editor.

unfortnately vite/esbuild have problems to bundle it.

any ideas/hints? thanks

✘ [ERROR] No matching export in "node_modules/monaco-editor/esm/vs/nls.js" for import "localizeWithPath"

    node_modules/@codingame/monaco-vscode-files-service-override/node_modules/vscode/vscode/src/vs/platform/files/common/io.js:3:9:
      3 │ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';

https://github.com/cdietrich/my-monaco-editor-react-example/tree/cd/otherFilesExperiments

kaisalmen commented 10 months ago

@cdietrich I suspect you have mismatching monaco-editor versions. monaco-editor-workers@0.43.0 depends on 0.43.0 whereas vscode 1.83.x depends on 0.44.0.

cdietrich commented 10 months ago

Hmm as I use Monaco editor react I don’t have a explicit Monaco version at all

will check. Is there a new workers version planned ?

kaisalmen commented 10 months ago

monaco-editor-workers has a direct dependency to the corresponding monaco-editor. If only one of the two monaco-editor version gets treemended then there is a problem. If all have the same version everything is fine (⬇️). We are working on removing the treemending issues: https://github.com/TypeFox/monaco-languageclient/pull/564

Before: image

After: image

Build result image

cdietrich commented 10 months ago

hmmm just downgrading to 1.83.2 does not work.. same for upgrading everything what did you change to package.json?

kaisalmen commented 10 months ago

@cdietrich npm list monaco-editor or npm why monaco-editor is your friend. I changed monaco-editor-workers from 0.43.0 to 0.44.0. 🙂

cdietrich commented 10 months ago

hmm this is what i did and what does not work

[ERROR] Could not resolve "monaco-editor/esm/vs/platform/quickinput/browser/commandsQuickAccess.js" [ERROR] Could not resolve "monaco-editor/esm/vs/platform/quickinput/browser/pickerQuickAccess.js"

kaisalmen commented 10 months ago

@cdietrich strange. That was the only change on fresh check out and npm run build completed successfully. Try removing node_modules and package-lock.json and start fresh.

cdietrich commented 10 months ago

hmmm package lock was the problem :(

kaisalmen commented 10 months ago

With monaco-languageclient v7 (https://github.com/TypeFox/monaco-languageclient/pull/564) and explicit usage of the treemended monaco-editor package those problems will hopefully go away.

kaisalmen commented 9 months ago

@cdietrich new releases are available. treemended monaco-editor is now used everywhere.