Skip to content

Improve autocompletion in Monaco editor for js and ts files. #6410

@yann300

Description

@yann300

We need to improve the code completion in the editor.

See https://github.com/remix-project-org/remix-project/blob/master/libs/remix-ui/editor/src/lib/web-types.ts
For the context: we are adding types using the addExtraLibFunction. When these types are added, they become available in the autocompletion in monaco.
But now there are some issues:

  • all added type files are static, thus it doesn't update with the current version of that librarie.
  • some dependencies aren't added at all (chainlink, etc...)
  • the way we are calling addExtraLibFunction is suboptimal (we call it one time when the editor starts), one solution would be to parse the code, identify which libs are being used and add the types on the fly. For getting the type.ts file, we can use npm or jsdeliver.net. see for instance, one d.ts file for instance: https://unpkg.com/preact@10.26.4/src/index.d.ts .

Note that there might be a more efficient way of doing that. So I don't mean this is something you have to implement, please feel free to propose a better direction for this.

Metadata

Metadata

Assignees

Labels

editorRelated to code editor

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions