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

Refreshing LSP after adding a new file? #56

Closed
wojciech-kulik opened this issue Feb 28, 2024 · 8 comments
Closed

Refreshing LSP after adding a new file? #56

wojciech-kulik opened this issue Feb 28, 2024 · 8 comments

Comments

@wojciech-kulik
Copy link
Owner

wojciech-kulik commented Feb 28, 2024

When you add a new file, it always shows some errors because the LSP is unable to place this file in a project structure yet. You need to build the project and usually restart LSP.

Maybe it is possible to somehow improve this process?

Ideas:

  1. Run build in the background & call xcode-builld-server parse .nvim/xcodebuild/original_logs.log -o .nvim/xcodebuild/.compile?
  2. Is there any way to force an update without building? How Xcode achieved that?
  3. It could be also a limitation of sourcekit-lsp in their repo they say:
    SourceKit-LSP does not update its global index in the background, but instead relies on indexing-while-building to provide data. 
    This only affects global queries like find-references and jump-to-definition.
    Workaround: build the project to update the index
    
@Almaz5200
Copy link
Contributor

I actually mapped LSP Reloading on xL for this exact purpouse

@wojciech-kulik
Copy link
Owner Author

wojciech-kulik commented Feb 28, 2024

I found the connected ticket: apple/sourcekit-lsp#969. I guess it's worth subscribing there :).

@SolaWing
Copy link

SolaWing commented Mar 3, 2024

xcode-build-server normally doesn't need to restart as soon as parse logs. It will watch updated logs to send new flags to lsp.

@wojciech-kulik
Copy link
Owner Author

@SolaWing maybe some notification from BSP to LSP is needed to refresh diagnostics?

@SolaWing
Copy link

SolaWing commented Mar 3, 2024

currently only flags changes can be notified from BSP. and if flags is correct, LSP can figure out diagnostics. defs and refs seems to depend on the index-store file, which updated by the build command

@wojciech-kulik
Copy link
Owner Author

wojciech-kulik commented Mar 3, 2024

ok, I will check this issue one more time and I will create a ticket for sourcekit-lsp then

@wojciech-kulik
Copy link
Owner Author

@SolaWing is also trying to workaround this problem directly in xcode-build-server. The issue to track: SolaWing/xcode-build-server#43

@wojciech-kulik
Copy link
Owner Author

xcode-build-server v1.1.0 has been released. It should improve the workflow with new files.

In case of any issue please report it directly to: https://github.com/SolaWing/xcode-build-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants