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

formatting is blocked behind build? #1891

Open
MahdiBM opened this issue Dec 14, 2024 · 6 comments
Open

formatting is blocked behind build? #1891

MahdiBM opened this issue Dec 14, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@MahdiBM
Copy link
Contributor

MahdiBM commented Dec 14, 2024

Describe the bug
I'm not sure if this sourcekit-lsp's doing or this extension's.
When I trigger a build, then immediately trigger a format, it appears that the document-format action always waits for the build to complete.

To Reproduce
Steps to reproduce the behavior:
Trigger a build.
Trigger "Format Document".

Expected behavior
Formatting should not be stuck behind a build.

Environment
Sourcekit-lsp settings:

{
  "backgroundIndexing": true,
  "backgroundPreparationMode": "build",
  "maxCoresPercentageToUseForBackgroundIndexing": 0.7,
  "experimentalFeatures": ["on-type-formatting"]
}

"backgroundPreparationMode": "build", might have a role in this beahvior?

Additional context
Add any other context about the problem here.

@MahdiBM MahdiBM added the bug Something isn't working label Dec 14, 2024
@plemarquand
Copy link
Contributor

I think this is a sourcekit-lsp behaviour, transferring issue to that repo.

@plemarquand plemarquand transferred this issue from swiftlang/vscode-swift Dec 16, 2024
@ahoppen
Copy link
Member

ahoppen commented Dec 16, 2024

Synced to Apple’s issue tracker as rdar://141559494

@MahdiBM
Copy link
Contributor Author

MahdiBM commented Dec 18, 2024

@ahoppen how should I go around debugging this? Any tips?

@ahoppen
Copy link
Member

ahoppen commented Dec 18, 2024

What I would do is

  • Run log stream --predicate 'subsystem CONTAINS "sourcekit-lsp"' --level debug --signpost
  • Reproduce the issue
  • Safe the output from log stream to a file, eg. /tmp/log.txt
  • Convert the signposts into a trace using sourcekit-lsp debug trace-from-signposts
  • Open the trace in https://ui.perfetto.dev

There you should see a timeline of the requests and you can see which request might be blocking other requests. MessageHandlingDependencyTracker.swift is the relevant file that defines request/notification dependencies.

I think the trace-from-signposts is only available in Swift 6.1-aligned SourceKit-LSP releases but the signposts might be logged on older SourceKit-LSP versions as well, I’m not entirely sure. Also, this debugging utility currently only works on macOS.

@MahdiBM
Copy link
Contributor Author

MahdiBM commented Dec 23, 2024

I seem to be unable to reproduce this on swift-6.1-DEVELOPMENT-SNAPSHOT-2024-12-21-a.

@MahdiBM
Copy link
Contributor Author

MahdiBM commented Dec 25, 2024

@ahoppen perhaps we should have a label like "awaiting-release"?
Because there is also the other formatting issue which you reopened since the changes were not released yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

3 participants