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

LSP Semantic Token Decoder, Improve LSP-CodeFileDoc Arch #1951

Merged

Conversation

thecoolwinter
Copy link
Collaborator

@thecoolwinter thecoolwinter commented Dec 19, 2024

Description

  • Implements a decoding object for LSPs to translate the compressed LSP semantic token objects to a format CodeEditSourceEditor can read. See spec.
  • Improves the relationship between language servers and code files architecturally.
    • Moves ownership of lsp content coordinators to language server object. This improves the readability of the content coordinator as it now has a non-optional initializer.
    • Adds didOpen/didClose notifications to CodeFileDocument, allowing it to tell anyone who needs to know (LSP, future extensions) that it was opened. This helps decouple the document object from LSP, though there is still a reference to the LSP through the published lspCoordinator property.
    • Updates the LanguageServerFileMap class to be more extendable as more objects are added for coordinating LSP-document interactions.

This architectural change could be improved further. However I think making this change larger is worse overall. In the future I'd like to make a protocol that the language server can consume for documents, that CodeFileDocument conforms to via an extension. That should make things easier to test too.

One small change that went with the second point

  • Moved dep injection initialization to the SwiftUI app initializer as it happens before anything in AppDelegate.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

N/A

@thecoolwinter thecoolwinter added architecture language server Issues or Pull Requests related to language servers. labels Dec 19, 2024
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

Looks good from what I can tell!

@thecoolwinter thecoolwinter merged commit f580ef5 into CodeEditApp:main Dec 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture language server Issues or Pull Requests related to language servers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants