Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch CodeMirror to get completions via the language server #66

Merged
merged 11 commits into from
Dec 12, 2023

Conversation

siefkenj
Copy link
Contributor

@siefkenj siefkenj commented Dec 10, 2023

This PR adds language server support to codemirror for autocompletion. This will allow completion of macros in the future. It also uses react-codemirror to manage the codemirror interface rather than manually managing it through references.

@siefkenj
Copy link
Contributor Author

@dqnykamp This should be ready to merge :-)

packages/vscode-extension/src/language-server/index.ts Outdated Show resolved Hide resolved
packages/lsp/package.json Outdated Show resolved Hide resolved
packages/lsp/package.json Outdated Show resolved Hide resolved
@@ -166,6 +166,25 @@ describe("AutoCompleter", () => {
`);
}
});
it("Can suggest completions after a `<`", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests makes me think that after typing "<" in the editor, I should get some completions. However I don't get completions after typing just "<" inside a <codeEditor> tag (in test-viewer dev server) or inside the editor from the dev server in lsp-tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I need to look into that then...It gives suggestions to me when testing out in packages/codemirror.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it out more. It turns out it doesn't work if my cursor is at the end of the file, but it works otherwise. I was always testing at the end of the file, so it wasn't working.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When at the end of the file, typing < does now start the autocomplete. But, if subsequently type a, then the autocomplete closes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if at end of file and have an unclosed open tag, then < does not suggest the closing tag.

@siefkenj
Copy link
Contributor Author

Autocomplete should now work for opening tags at the end of a string. Closing tags are still an issue. I added a .skip test for closing tags which can be used when this issue is ready to be tackled again.

Copy link
Member

@dqnykamp dqnykamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining autocomplete issues for closing tags are given in issue #71.

@dqnykamp dqnykamp merged commit a83f4e9 into Doenet:main Dec 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants