zed-industries / extensions

Extensions for the Zed editor
868 stars 373 forks source link

Swift #139

Closed aleksrutins closed 6 months ago

aleksrutins commented 2 years ago

Is your feature request related to a problem? Please describe. I'd like to be able to use Zed to work on my Swift projects.

Describe the solution you'd like SourceKit-LSP could be used.

Describe alternatives you've considered N/A?

Screenshots N/A

aleksrutins commented 2 years ago

Tree-sitter parser: https://github.com/alex-pinkus/tree-sitter-swift

Saafo commented 1 year ago

Any progress in last half year? Can't wait to use Zed beta in my swift project!

arguiot commented 1 year ago

Any progress on this? With recent Copilot support, using Zed & Xcode together is something I'm really looking for.

flbn commented 1 year ago

^^^

hovsater commented 1 year ago

Nothing to report just yet. I'll make sure to report back when there's news to share. 🙂

ValentinWalter commented 1 year ago

Can't wait for this!

marcusziade commented 8 months ago

Any updates?

marcusziade commented 8 months ago

If someone can explain what the starting point of adding Swift support to this is, I can attempt to do it

ValentinWalter commented 8 months ago

If someone can explain what the starting point of adding Swift support to this is, I can attempt to do it

You'd need to integrate with the Swift LSP. From a quick glance at the repo it looks like https://github.com/zed-industries/zed/blob/main/plugins/json_language/src/lib.rs might be a good place to start.

fdionisi commented 8 months ago

eI think the plugin story may take a bit longer, but it's part of the roadmap. You may want to wait a little longer or join the conversation in Zed, otherwise take a look at how other languages are implemented in language.rs.

Also, https://github.com/zed-industries/zed/pull/5816 is a good one on how to add LSPs.

Edit: some info in the docs, too.

iamnbutler commented 8 months ago

I tried adding swift a while back – the issue I ran into was the treesitter grammar was so immensely slow it could take 10-30 seconds on a 32core 64gb ram m1 for a single file to highlight – I ended up abandoning it due to that experience being awful.

iamnbutler commented 8 months ago

I got it working in a few hours so I'm sure someone can reproduce it pretty quickly to see if the experience has improved – if it hasn't we would likely need to wait until there is a better grammar, I don't think we will be willing to ship a language that impacts editor perf to that degree.

iamnbutler commented 8 months ago

Feel free to pick up from here: https://github.com/zed-industries/zed/pull/2748. This is Zed1 though so the approach may be different, I'm not sure.

fbartho commented 8 months ago

@iamnbutler silly question: why did you go with tree-sitter-swift instead of building on the official LSP?

Would the official LSP have been slower? Or was it more that tree-sitter was already a common pattern so it was less work?

marcusziade commented 8 months ago

I've integrated the sourcekit-lsp into Neovim and had no performance issues

iamnbutler commented 8 months ago

@iamnbutler silly question: why did you go with tree-sitter-swift instead of building on the official LSP?

Would the official LSP have been slower? Or was it more that tree-sitter was already a common pattern so it was less work?

Forgive me if I'm wrong, but you will still need a tree-sitter grammar to get syntax highlighting right?

Saafo commented 8 months ago

can we build the treesitter above nvim-treesitter?

ivanglushko commented 8 months ago

If someone can explain what the starting point of adding Swift support to this is, I can attempt to do it

Awesome! Just curious, have you started yet?

marcusziade commented 8 months ago

If someone can explain what the starting point of adding Swift support to this is, I can attempt to do it

Awesome! Just curious, have you started yet?

No, I haven't started and got turned off by the comments above. I'm also busy with my side project and don't wanna take on too much at this time.

I mean, I want to, but you know. Maybe if someone worked together with me on it?

ceopaludetto commented 8 months ago

I've started to play around with zed codebase and tree-sitter-swift but I quickly found this issue https://github.com/alex-pinkus/tree-sitter-swift/issues/240, some queries are really slow. Anyway, it kinda works.

Screenshot 2024-01-26 at 16 06 42
marcusziade commented 8 months ago

Would you demonstrate what a "slow query" actually looks like in practice?

Wouldn't surprise me if the slowest slowdowns in Zed are faster than the fastest things in Xcode.

ceopaludetto commented 8 months ago

Would you demonstrate what a "slow query" actually looks like in practice?

Wouldn't surprise me if the slowest slowdowns in Zed are faster than the fastest things in Xcode.

I've added the suggested highlights.scm file which you can found here https://github.com/alex-pinkus/tree-sitter-swift/blob/main/queries/highlights.scm. Even on a small file(15 lines) it took approximately 30 seconds to highlight on my M1 Pro in debug mode, example video:

https://github.com/zed-industries/zed/assets/30508218/32772337-d03e-4e82-8357-5d632b0e8c52

Also the LSP does not work(and only start to process after tree-sitter parsing mechanism). I'll draft a pull request because I'm probably doing something wrong.

marcusziade commented 8 months ago

Is it only an initial load or for every file change? Do Git diffs affect it somehow?

ceopaludetto commented 8 months ago

Is it only an initial load or for every file change? Do Git diffs affect it somehow?

On initial load only, subsequent modifications work as expected. I also tested on a package without .git and it does not seem related.

Draft PR: https://github.com/zed-industries/zed/pull/6831

marcusziade commented 8 months ago

If it's only once, I wouldn't mind that much. The benefits outweigh that.

ADGrant commented 8 months ago

This is a very interesting project and I like the focus on performance. I think it's unfortunate that an editor only available on MacOS doesn't support Swift though. Most Swift developers do use Macs.

iamnbutler commented 8 months ago

Yeah those slowdowns were the same reason I abandoned my PR last year - from our PoV in an editor all about performance it feels pretty bad to have a supported language take 30 seconds to highlight.

Now that extensions are coming, if someone wanted to opt in to that that would be fine.

I do wonder what the root cause of all the slowness is though.

marcusziade commented 8 months ago

Is it using Swift-syntax? That has caused many slowdowns for many

subdigital commented 8 months ago

I’ll admit that sourcekit-lsp is pretty limited, but performance with completion and highlighting with tree sitter are not an issue in neovim.Sent from my iPhoneOn Feb 14, 2024, at 3:11 PM, Marcus Ziadé @.***> wrote: Is it using Swift-syntax? That has caused many slowdowns for many

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

marcusziade commented 8 months ago

I'm using sourcekit-lsp in Neovim as well and see no slowdowns.

pblazej commented 8 months ago

Used by Swift VSCode as well, works fine.

megabitsenmzq commented 8 months ago

With SourceKit-LSP support, I can use xcode-build-server with Zed to develop iOS apps. It will be great!

ostwilkens commented 8 months ago

It's not uncommon for my XCode to randomly have 1s input lag. Being able to code in Zed would be a breath of fresh air.

marcusziade commented 8 months ago

Xcode has A LOT of main thread blocking, indeed.

megabitsenmzq commented 8 months ago

If we also use InjectionIII, we can even have a real-time preview alongside Zed. 😂

yeahitsjan commented 7 months ago

Is there any update on this? I would really like to move from Sublime Text to Zed. Atleast highlighting would be nice..

marcusziade commented 7 months ago

Is there any update on this? I would really like to move from Sublime Text to Zed. Atleast highlighting would be nice..

There's a syntax extension. Haven't tried it yet.

Moshyfawn commented 7 months ago

Is there any update on this? I would really like to move from Sublime Text to Zed. Atleast highlighting would be nice..

There's already a community Swift syntax highlighting extension. Try searching for it in the extensions tab in Zed.

The ability to tie in an LSP is coming to Zed a bit later.

Shock9616 commented 6 months ago

I'm using sourcekit-lsp in Neovim as well and see no slowdowns.

I also use Neovim, the lsp isn't the thing causing slowdowns, it's 100% the treesitter grammar. All the slowdowns go away as soon as I disable treesitter

awamser commented 6 months ago

The workaround, until LSP is added, is to install Apple's swift-format ( https://github.com/apple/swift-format ) and run it from the command line.

Example find ./Sources -name "*.swift" -exec swift-format -i {} \;

JosephTLyons commented 6 months ago

As others have mentioned, the extension store now has an extension for Swift:

SCR-20240412-lnuu

Zed extensions now support language servers, but it looks like the package hasn't been updated yet to include one. Here is the issue requesting that.

Let's close this issue out and move dialogue / PRs over the extension owner's (@louisnicolas-longheval-vinci) repository.

awamser commented 6 months ago

Based on the author's comments for the zed-swift extension, there are plans to add something other than source-kit support.

https://github.com/louisnicolas-longheval-vinci/zed-swift-extension/issues/5

furby-tm commented 6 months ago

I'm a bit confused on the approach here ~ What was the reason for giving Swift the boot, and ejecting it out of Zed, while keeping the other 44 languages that Zed ships with out of the box?

deevus commented 6 months ago

I'm a bit confused on the approach here ~ What was the reason for giving Swift the boot, and ejecting it out of Zed, while keeping the other 44 languages that Zed ships with out of the box?

It looks like languages as extensions is the preferred approach going forward. Check out the breaking changes here: https://zed.dev/releases/stable/0.130.4

furby-tm commented 6 months ago

Preferred, as in rendered useless by removing the ability to add a sourcekit adapter for full and proper support?

Like so?

Why is Swift being treated as a second class citizen? I would hope that the Zed developers do not classify the Swift programming language as being one of "those" languages:

Removed built-in support for C#, Clojure, Erlang, PHP, TOML, and Zig, in favor of making them available as extensions.

What would it require to hold Swift to the same standard that is currently being applied to Rust?

JosephTLyons commented 6 months ago

My current understanding is that all of the languages currently baked into Zed, will be pulled out into extensions. Those removals are happening in batches, so the process isn't finished. We also don't necessarily plan to be the ones upkeeping all of those languages, especially the more esoteric ones that were added for weekend projects by members of the team - we will likely be on the lookout for maintainers of these languages, so that they get the proper care they need.

As it stands, all of these languages have been removed from Zed, pulled into extensions, and uploaded to the extensions store - it is just that their crates are currently housed in-tree, until we know where they will ultimately end up.

Preferred, as in rendered useless by removing the ability to add a sourcekit adapter for full and proper support?

Unless there's some edge case that specifically prevents sourcekit from being used as a language server in Zed, the extension should be able to provide this, as extensions now have the ability to install language servers on the user's system. The swift extension needs to add a rust crate that contains logic similar to this file - specifically, it needs to tell Zed where to find the language server and it needs to impl the zed::extension trait:

furby-tm commented 6 months ago

@JosephTLyons I will give this a shot for Swift, and I really appreciate your insight.

You guys have done a phenomenal job with Zed, and the impact it's having for Rust. But I just want to emphasize on the importance of additionally adopting Swift into your existing development stack -- they each solve a very different subset of challenges, and when used together, they compliment each other in extraordinary ways.

As we continue to build our open source ecosystem, it's imperative that we unify these two languages together, to evolve and empower all developers.

ejjonny commented 5 months ago

@furby-tm Any luck?

I tried to get this running as an extension today. Either I am missing something or sourcekit is.

The majority of requests just happily respond with empty results & sending a closeDocument message occasionally crashes the server with no error message.

If anyone has ideas, I am out of them 🙂

Here's my code: https://github.com/ejjonny/swift-ext

Image 4-26-24 at 5 10 PM

Here are the initialization logs:

stderr: [2024-04-26 18:46:18.386] SourceKitServer: Request<initialize>(
stderr: id: 0,
stderr: clientID: ObjectIdentifier(0x0000600001319c00),
stderr: params: InitializeRequest(processId: nil, clientInfo: nil, locale: nil, rootPath: nil, rootURI: Optional(LanguageServerProtocol.DocumentURI(storage: file:///Users/ejohn/Documents/zzz/tester)), initializationOptions: nil, capabilities: LanguageServerProtocol.ClientCapabilities(workspace: Optional(LanguageServerProtocol.WorkspaceClientCapabilities(applyEdit: nil, workspaceEdit: Optional(LanguageServerProtocol.WorkspaceClientCapabilities.WorkspaceEdit(documentChanges: Optional(true))), didChangeConfiguration: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: Optional(true))), didChangeWatchedFiles: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: Optional(true))), symbol: Optional(LanguageServerProtocol.WorkspaceClientCapabilities.Symbol(dynamicRegistration: nil, symbolKind: nil)), executeCommand: nil, workspaceFolders: Optional(true), configuration: Optional(true), semanticTokens: nil)), textDocument: Optional(LanguageServerProtocol.TextDocumentClientCapabilities(synchronization: nil, completion: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Completion(dynamicRegistration: nil, completionItem: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Completion.CompletionItem(snippetSupport: Optional(true), commitCharactersSupport: nil, documentationFormat: nil, deprecatedSupport: nil, preselectSupport: nil)), completionItemKind: nil, contextSupport: nil)), hover: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Hover(dynamicRegistration: nil, contentFormat: Optional([LanguageServerProtocol.MarkupKind(rawValue: "markdown")]))), signatureHelp: nil, references: nil, documentHighlight: nil, documentSymbol: nil, formatting: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), rangeFormatting: nil, onTypeFormatting: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), declaration: nil, definition: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.DynamicRegistrationLinkSupportCapability(dynamicRegistration: nil, linkSupport: Optional(true))), typeDefinition: nil, implementation: nil, codeAction: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction(dynamicRegistration: nil, codeActionLiteralSupport: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction.CodeActionLiteralSupport(codeActionKind: LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction.CodeActionLiteralSupport.CodeActionKind(valueSet: [LanguageServerProtocol.CodeActionKind(rawValue: "refactor"), LanguageServerProtocol.CodeActionKind(rawValue: "quickfix"), LanguageServerProtocol.CodeActionKind(rawValue: "source")]))))), codeLens: nil, documentLink: nil, colorProvider: nil, rename: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), publishDiagnostics: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.PublishDiagnostics(relatedInformation: Optional(true), codeActionsInline: nil, codeDescriptionSupport: nil)), foldingRange: nil, callHierarchy: nil, semanticTokens: nil, inlayHint: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.InlayHint(dynamicRegistration: Optional(false), resolveSupport: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.InlayHint.ResolveSupport(properties: ["textEdits", "tooltip", "label.tooltip", "label.location", "label.command"])))), diagnostic: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Diagnostic(dynamicRegistration: nil, relatedDocumentSupport: Optional(true)))))), trace: nil, workspaceFolders: Optional([LanguageServerProtocol.WorkspaceFolder(uri: LanguageServerProtocol.DocumentURI(storage: file:///Users/ejohn/Documents/zzz/tester), name: "")]))
stderr: )
stderr: [2024-04-26 18:46:18.392] SourceKitServer: Response<initialize(0)>(
stderr: success(LanguageServerProtocol.InitializeResult(capabilities: LanguageServerProtocol.ServerCapabilities(positionEncoding: nil, textDocumentSync: Optional(LanguageServerProtocol.TextDocumentSync.options(LanguageServerProtocol.TextDocumentSyncOptions(openClose: Optional(true), change: Optional(LanguageServerProtocol.TextDocumentSyncKind.incremental), willSave: Optional(true), willSaveWaitUntil: Optional(false), save: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentSyncOptions.SaveOptions>.value(LanguageServerProtocol.TextDocumentSyncOptions.SaveOptions(includeText: Optional(false))))))), notebookDocumentSync: nil, hoverProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.HoverOptions>.bool(true)), completionProvider: Optional(LanguageServerProtocol.CompletionOptions(resolveProvider: Optional(false), triggerCharacters: Optional(["."]), allCommitCharacters: nil, completionItem: nil, workDoneProgress: nil)), signatureHelpProvider: nil, definitionProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DefinitionOptions>.bool(true)), typeDefinitionProvider: nil, implementationProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), referencesProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.ReferenceOptions>.bool(true)), documentHighlightProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DocumentHighlightOptions>.bool(true)), documentSymbolProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DocumentSymbolOptions>.bool(true)), workspaceSymbolProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.WorkspaceSymbolOptions>.bool(true)), codeActionProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.CodeActionServerCapabilities>.value(LanguageServerProtocol.CodeActionServerCapabilities.supportsCodeActionRequestsWithLiterals(LanguageServerProtocol.CodeActionOptions(codeActionKinds: nil, resolveProvider: nil, workDoneProgress: nil)))), codeLensProvider: nil, documentFormattingProvider: nil, documentRangeFormattingProvider: nil, documentOnTypeFormattingProvider: nil, renameProvider: nil, documentLinkProvider: nil, colorProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), foldingRangeProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), declarationProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), executeCommandProvider: Optional(LanguageServerProtocol.ExecuteCommandOptions(commands: ["semantic.refactor.command"], workDoneProgress: nil)), workspace: Optional(LanguageServerProtocol.WorkspaceServerCapabilities(workspaceFolders: Optional(LanguageServerProtocol.WorkspaceServerCapabilities.WorkspaceFolders(supported: Optional(true), changeNotifications: Optional(LanguageServerProtocol.ValueOrBool<Swift.String>.bool(true)))))), callHierarchyProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), typeHierarchyProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), semanticTokensProvider: nil, inlayHintProvider: nil, diagnosticProvider: nil, selectionRangeProvider: nil, linkedEditingRangeProvider: nil, monikerProvider: nil, inlineValueProvider: nil, experimental: nil)))
stderr: )
furby-tm commented 5 months ago

@ejjonny hey there! I have yet to take a look at this since the changes they added around how extensions now work in Zed.

I'd like this to be a proper replacement for visual studio code, but I'm not quite sure if SourceKit-LSP will work well with the existing Zed API or not yet.

I believe there should also be a new outline.scm file created for Swift.

However, the continuous crashing of the SourceKit-LSP server does sound familiar to what I remember, hoping that someone might have insight as to why that might be happening.

WeetHet commented 5 months ago

@furby-tm Any luck?

I tried to get this running as an extension today. Either I am missing something or sourcekit is.

The majority of requests just happily respond with empty results & sending a closeDocument message occasionally crashes the server with no error message.

If anyone has ideas, I am out of them 🙂

Here's my code: https://github.com/ejjonny/swift-ext

Image 4-26-24 at 5 10 PM

Here are the initialization logs:

stderr: [2024-04-26 18:46:18.386] SourceKitServer: Request<initialize>(
stderr: id: 0,
stderr: clientID: ObjectIdentifier(0x0000600001319c00),
stderr: params: InitializeRequest(processId: nil, clientInfo: nil, locale: nil, rootPath: nil, rootURI: Optional(LanguageServerProtocol.DocumentURI(storage: file:///Users/ejohn/Documents/zzz/tester)), initializationOptions: nil, capabilities: LanguageServerProtocol.ClientCapabilities(workspace: Optional(LanguageServerProtocol.WorkspaceClientCapabilities(applyEdit: nil, workspaceEdit: Optional(LanguageServerProtocol.WorkspaceClientCapabilities.WorkspaceEdit(documentChanges: Optional(true))), didChangeConfiguration: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: Optional(true))), didChangeWatchedFiles: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: Optional(true))), symbol: Optional(LanguageServerProtocol.WorkspaceClientCapabilities.Symbol(dynamicRegistration: nil, symbolKind: nil)), executeCommand: nil, workspaceFolders: Optional(true), configuration: Optional(true), semanticTokens: nil)), textDocument: Optional(LanguageServerProtocol.TextDocumentClientCapabilities(synchronization: nil, completion: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Completion(dynamicRegistration: nil, completionItem: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Completion.CompletionItem(snippetSupport: Optional(true), commitCharactersSupport: nil, documentationFormat: nil, deprecatedSupport: nil, preselectSupport: nil)), completionItemKind: nil, contextSupport: nil)), hover: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Hover(dynamicRegistration: nil, contentFormat: Optional([LanguageServerProtocol.MarkupKind(rawValue: "markdown")]))), signatureHelp: nil, references: nil, documentHighlight: nil, documentSymbol: nil, formatting: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), rangeFormatting: nil, onTypeFormatting: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), declaration: nil, definition: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.DynamicRegistrationLinkSupportCapability(dynamicRegistration: nil, linkSupport: Optional(true))), typeDefinition: nil, implementation: nil, codeAction: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction(dynamicRegistration: nil, codeActionLiteralSupport: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction.CodeActionLiteralSupport(codeActionKind: LanguageServerProtocol.TextDocumentClientCapabilities.CodeAction.CodeActionLiteralSupport.CodeActionKind(valueSet: [LanguageServerProtocol.CodeActionKind(rawValue: "refactor"), LanguageServerProtocol.CodeActionKind(rawValue: "quickfix"), LanguageServerProtocol.CodeActionKind(rawValue: "source")]))))), codeLens: nil, documentLink: nil, colorProvider: nil, rename: Optional(LanguageServerProtocol.DynamicRegistrationCapability(dynamicRegistration: nil)), publishDiagnostics: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.PublishDiagnostics(relatedInformation: Optional(true), codeActionsInline: nil, codeDescriptionSupport: nil)), foldingRange: nil, callHierarchy: nil, semanticTokens: nil, inlayHint: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.InlayHint(dynamicRegistration: Optional(false), resolveSupport: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.InlayHint.ResolveSupport(properties: ["textEdits", "tooltip", "label.tooltip", "label.location", "label.command"])))), diagnostic: Optional(LanguageServerProtocol.TextDocumentClientCapabilities.Diagnostic(dynamicRegistration: nil, relatedDocumentSupport: Optional(true)))))), trace: nil, workspaceFolders: Optional([LanguageServerProtocol.WorkspaceFolder(uri: LanguageServerProtocol.DocumentURI(storage: file:///Users/ejohn/Documents/zzz/tester), name: "")]))
stderr: )
stderr: [2024-04-26 18:46:18.392] SourceKitServer: Response<initialize(0)>(
stderr: success(LanguageServerProtocol.InitializeResult(capabilities: LanguageServerProtocol.ServerCapabilities(positionEncoding: nil, textDocumentSync: Optional(LanguageServerProtocol.TextDocumentSync.options(LanguageServerProtocol.TextDocumentSyncOptions(openClose: Optional(true), change: Optional(LanguageServerProtocol.TextDocumentSyncKind.incremental), willSave: Optional(true), willSaveWaitUntil: Optional(false), save: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentSyncOptions.SaveOptions>.value(LanguageServerProtocol.TextDocumentSyncOptions.SaveOptions(includeText: Optional(false))))))), notebookDocumentSync: nil, hoverProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.HoverOptions>.bool(true)), completionProvider: Optional(LanguageServerProtocol.CompletionOptions(resolveProvider: Optional(false), triggerCharacters: Optional(["."]), allCommitCharacters: nil, completionItem: nil, workDoneProgress: nil)), signatureHelpProvider: nil, definitionProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DefinitionOptions>.bool(true)), typeDefinitionProvider: nil, implementationProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), referencesProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.ReferenceOptions>.bool(true)), documentHighlightProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DocumentHighlightOptions>.bool(true)), documentSymbolProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.DocumentSymbolOptions>.bool(true)), workspaceSymbolProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.WorkspaceSymbolOptions>.bool(true)), codeActionProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.CodeActionServerCapabilities>.value(LanguageServerProtocol.CodeActionServerCapabilities.supportsCodeActionRequestsWithLiterals(LanguageServerProtocol.CodeActionOptions(codeActionKinds: nil, resolveProvider: nil, workDoneProgress: nil)))), codeLensProvider: nil, documentFormattingProvider: nil, documentRangeFormattingProvider: nil, documentOnTypeFormattingProvider: nil, renameProvider: nil, documentLinkProvider: nil, colorProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), foldingRangeProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), declarationProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), executeCommandProvider: Optional(LanguageServerProtocol.ExecuteCommandOptions(commands: ["semantic.refactor.command"], workDoneProgress: nil)), workspace: Optional(LanguageServerProtocol.WorkspaceServerCapabilities(workspaceFolders: Optional(LanguageServerProtocol.WorkspaceServerCapabilities.WorkspaceFolders(supported: Optional(true), changeNotifications: Optional(LanguageServerProtocol.ValueOrBool<Swift.String>.bool(true)))))), callHierarchyProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), typeHierarchyProvider: Optional(LanguageServerProtocol.ValueOrBool<LanguageServerProtocol.TextDocumentAndStaticRegistrationOptions>.bool(true)), semanticTokensProvider: nil, inlayHintProvider: nil, diagnosticProvider: nil, selectionRangeProvider: nil, linkedEditingRangeProvider: nil, monikerProvider: nil, inlineValueProvider: nil, experimental: nil)))
stderr: )

This is super weird: This is the JSON-RPC request sent by neovim, which gets the correct response:

{
  "id": 3,
  "jsonrpc": "2.0",
  "method": "textDocument/hover",
  "params": {
    "position": { "character": 21, "line": 2 },
    "textDocument": {
      "uri": "file:///Users/weethet/Projects/Playgrounds/SwiftPlayground/Sources/main.swift"
    }
  }
}

And this request from Zed doesn't:

{
  "jsonrpc": "2.0",
  "id": 65,
  "method": "textDocument/hover",
  "params": {
    "textDocument": {
      "uri": "file:///Users/weethet/Projects/Playgrounds/SwiftPlayground/Sources/main.swift"
    },
    "position": { "line": 2, "character": 18 }
  }
}

I don't know why, they seem very similar to me