Commit Graph

18 Commits

Author SHA1 Message Date
Adam Fowler
baa39c54ce Set didChangedWatchedFiles glob to **/*.ext
**.ext will only look in the base folder
2022-01-28 12:08:15 +01:00
Alex Hoppen
ffad5be7ae Only reload SwiftPM package if a file that is relevant to SwiftPM changes 2022-01-24 20:02:42 +01:00
Alex Hoppen
0dcaca5397 Reload Swift Package when new file creation is indicated by DidChangeWatchedFileNotification
Implement rudementary support for `DidChangeWatchedFileNotification` for SwiftPM projects: When a file is added, reload the Swift package to compute build settings for it.

This enables proper semantic functionality added to the project after the LSP server was started.

Resolves SR-15633
2022-01-24 20:02:42 +01:00
David Goldman
d29d1254a4 Add support for clangd commands + code actions (#429)
This adds support for clangd commands for clients which support
dynamic registration (including VS Code), as well as fixes an
issue which prevented clangd's code actions from working.

Also added a test to ensure the clangd code actions work, as well as regenerated the Linux test main (which was missing some other newly added tests).
2021-09-29 09:38:49 -04:00
David Goldman
9cda11628b Use dynamic registration for folding range options
Dynamically register because clangd doesn't currently support it, but
may in the future.

Change-Id: I2bf139ea8aad09b58232ba9d09dfddcd89b977cd
2021-07-01 16:35:46 -04:00
Fredrik Wieczerkowski
3fef5145ea Add support for inlay hints using CollectExpressionType
- Add UID for CollectExpressionType request
- Add ExpressionTypeInfo structure
- Add keys to support sourcekitd's CollectExpressionType
- Implement CollectExpressionType request
- Add SwiftLanguageServer.expressionTypeInfos
- Add InlayHint and supporting types
- Add InlayHintsRequest
- Add inlayHints handler stub
- Implement inlay hints request
- Update InlayHint to follow the current proposal
- # This is the commit message #11:
- ...as described in the LSP proposal
- Update doc comment on InlayHintsRequest
- Map inlay hints lazily
- Fix minor style issue
- Add new files to CMakeLists.txt
- Specify commit of the current inlay hints proposal state
- Add public, memberwise initializer for InlayHintsRequest
- assert(false) if deserializing ExpressionTypeInfos fails
- Add dispatch precondition to _expressionTypeInfos
- Add InlayHintsRequest to the builtinRequests
- Factor out function for querying document symbols for URI
- Only render inlay hints after variable bindings
- Test inlay hints on empty document
- Test inlay hints for some simple bindings
- Test ranged inlay hint requests
- Make sure that inlay hints are unique per position
- Test inlay hints for fields
- Apply various PR suggestions regarding inlay hints
- Update inlay hint tests and add case with explicit type annotations
- Continue iterating if an ExpressionTypeInfo fails to deserialize
2021-06-10 16:41:54 +02:00
David Goldman
ad9b09e335 Add support for clangd's semantic highlighting (#388)
- Add LSP types for semantic highlighting
- Limited to clients which support dynamic registration for semantic highlighting
- Requires clangd 11 or later
2021-04-12 16:44:30 -04:00
David Goldman
3635d2531c Dynamically register completion options for supporting clients (#380)
Using dynamic registration (when supported by the client) allows
us to provide different completion options for ObjC and Swift
files.

We should be able to expand this to other capabilities in the future
(e.g. semantic highlighting, execute command support).
2021-04-06 16:33:05 -04:00
Ben Langmuir
7788bff20d Fix lifetime issues in tests
A number of tests were failing with the -Onone lifetime changes.
Regardless of what happens with that change, I'd like to keep our tests
passing with the stricter rules since we also test in release builds.
2021-04-05 15:54:29 -07:00
Alex Hoppen
a0c9b30a2a Restart sourcekitd and clangd after they have crashed 2021-01-18 13:30:35 +01:00
David Goldman
ae96dcae4e Improve performance of workspace/symbol for large queries + projects (#317)
- Avoid short queries (< 3 characters) since they are slow and noisy. Xcode does the same thing.

- Limit the number of results returned:
  - Improves performance for queries which match many symbols
  - Currently take the first N results to improve performance for large projects
    but once we support cancellation we should take the top N.
2020-09-28 15:13:36 -04:00
Ben Langmuir
a5832e978b [gardening] Fix copyright headers and formating in modified files 2020-07-29 09:55:02 -07:00
Ben Langmuir
232fb7bfe0 [completion] Fix tests when using server-side filtering
With this change, tests pass whether we default to server-side or
client-side filtering. Also duplicate a few interesting tests to run
both ways. A future commit will beef up the test coverage for
server-side filtering specifically.
2020-07-29 09:42:47 -07:00
Ben Langmuir
c27a76c9c5 [completion] Pass through new code-completion options 2020-07-29 09:42:18 -07:00
David Goldman
2840c7dac9 Forward definition requests when index lookup fails (#294)
* Forward definition requests when index lookup fails

If we're unable to look up a definition or declaration via the
index, forward the request to the language service.

This allows clangd to support go to definition or declaration
for symbols defined/declared in the AST.
2020-07-09 15:41:08 -04:00
David Goldman
5977d611aa Withhold diagnostics when fallback arguments are being used (#281)
While fallback arguments are being used (either from the fallback build system or fallback settings from the primary build system), withhold semantic diagnostics from sourcekitd and all diagnostics from clangd. This helps prevent user confusion from spurious errors.

- Also remove the DocumentURI standardization in favor of proper equality + hash checks to work around the %40 --> @ encoding issue seen on CI.
2020-06-11 11:38:50 -04:00
Ben Langmuir
1040621ae1 Shutdown toolchain connections on exit
When using SourceKit-LSP in tests (or otherwise in a library), we do not
want to leak the toolchain connections.
2020-06-09 13:20:15 -07:00
Ben Langmuir
4ff14d278d Rename module SourceKit -> SourceKitLSP
Clarify its role, since it is not really an LSP-independent interface
right now.
2020-06-04 14:49:00 -07:00