You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix #331 - feat: Integrate the language service with Monaco - #460
Integrate @openworkflowspec/language-service with Monaco in @openworkflowspec/text-editor using @volar/monaco.
The integration should expose the language-service capabilities in Monaco
Completions: In Empty JSON, enter {}, press Ctrl+Space, and verify the document and do suggestions.
Hello World: In Empty JSON, use either the Create an Open Workflow CodeLens or the Insert Hello World workflow completion. Both should insert the sample workflow.
Syntax diagnostics: Enter {invalid and verify that a syntax error appears.
Schema diagnostics: Open Invalid Workflow, verify the warnings, then replace its content with a valid workflow. The warnings should disappear.
Read-only: Enable isReadOnly. Editing and the CodeLens should be disabled.
Language switching: Switch between JSON and YAML. The CodeLens should appear only for editable, empty JSON documents.
YAML: Verify that syntax highlighting still works.
Update Welcome example for required language service worker prop
packages/text-editor/README.md:36
The new required createLanguageServiceWorker prop is not reflected in the existing stories/introduction/Welcome.mdx usage example, which still renders <TextEditor content={content} language="yaml" ... /> without it. That example is now not a valid TextEditor usage (and omits how to construct the worker); please update the introductory example alongside this API change.
@fantonangeli Thanks for PR, looks really good, and thanks for the preview link which makes it very easy to test. Still reviewing but noticed you mention in description "YAML: Verify that syntax highlighting still works."
It doesnt seem to highlight syntax issues?
@lornakelly Syntax highlights are the colours in the code. In your screenshot green/aqua are the props, and orange the values.
Syntax issues are underlined through the Diagnostics, like in the screenshot below where I removed a ","
@fantonangeli Thanks for PR, looks really good, and thanks for the preview link which makes it very easy to test. Still reviewing but noticed you mention in description "YAML: Verify that syntax highlighting still works."
It doesnt seem to highlight syntax issues?
@lornakelly Syntax highlights are the colours in the code. In your screenshot green/aqua are the props, and orange the values. Syntax issues are underlined through the Diagnostics, like in the screenshot below where I removed a ","
Thats what I mean, in the yaml there isnt, in screenshot I deleted the call value but no squiggle
I investigated the issue and tried supporting multiple TextEditor instances on the same Docs page, but ran into two problems related to Monaco's global registries:
Model URIs: All editors initially used the same URI (inmemory://openworkflow/workflow.json), causing the Cannot add model because it already exists! error. Assigning a unique URI to each editor resolved this.
CodeLens commands: Monaco registers commands globally. My openworkflow.insertHelloWorld command captures the editor's model, so clicking the CodeLens in one editor ends up modifying the last mounted editor instead. See the screencast.
Supporting multiple editors simultaneously would require a refactoring of command registration and potentially language provider management.
I've kept this outside the scope of this PR and customized the Storybook Docs page to render only one TE. All other stories remain available individually.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #331
Description
Integrate @openworkflowspec/language-service with Monaco in @openworkflowspec/text-editor using @volar/monaco.
The integration should expose the language-service capabilities in Monaco
How to test
Run Storybook or open the preview:
Open Features / Text-Editor and verify:
{}, pressCtrl+Space, and verify thedocumentanddosuggestions.{invalidand verify that a syntax error appears.isReadOnly. Editing and the CodeLens should be disabled.Preview:
https://fantonangeli.github.io/open-workflow-specification-editor/issue-331
issue-331-feat-Integrate-the-language-service-with-Monaco.mp4