Sharing context between multiple editors

Hi,

I am working on a tool which has a JS and HTML editor.
Inside the HTML you can access variables that are defined inside the JS editor by putting the variables between curly braces.

How can i provide intellisense (autocompletions) inside the HTML editor based on the JS editor’s context?

image

Thanks in advance!

It should be possible to run localCompletionSource with a completion context allocated at the start of the document in the JS editor state to get a set of options for the variables defined there, and wire a completion function that uses that (if the cursor is in the appropriate position) into the HTML editor.

2 Likes

Hi Marijn,

thanks for your quick anwser!
I have applied this and it works for the most part. I’m able to get all top level defined variables and functions.

However, when trying to access any properties on a variable, it fails to find any options for that.
Is there a workaround for that, or can i only access toplevel defined variables?

Thanks for the help!

Type inference is not something the built-in completions do, so even in a JS editor you don’t get property completions for variables.