The test system depended on the shebang to locate the python
interpreter. However, this is not a portable system. Instead, prefer
to explicitly search for the interpreter prior to the execution. This
enables supporting execution of the script support on all platforms. A
secondary change of the printed string is required for Windows. Python
will replace `\n` with `\r\n` resulting in `\r\n` being emitted as
`\r\r\n` on Windows breaking the expectations on the receiver. Adjust
this by explicitly writing out a binary string to the raw underlying
buffer to avoid the translation.
Replace the use of the deprecated `Lock` from swift-tools-support-core
with `NSLock`. The benefit of the deprecated interface was the
`withLock` function which is easily replicated and very unlikely to
change. By doing so we avoid the warnings about `Lock` being deprecated
when building SourceKit-LSP.
When converting the URI to a path string, ensure that we convert to the
file system representation. This is important as this ensures that we
are always passing SourceKit the native path string. With this change,
the code completion behaviour for the LSP test suite on Windows is
repaired.
This adjusts the imports in this particular source file to explicitly import Foundation to allow the use of `URL`. This is a future error and currently a warning. This cleans up a warning.
This adds a check when creating a `TextEdit` to return `nil` if both the fixit and the replacement being used to create a `TextEdit` are empty. A `TextEdit` being created like this can cause a crash.
Previously if you had a normal source file named Package.swift
sourcekit-lsp would pick it up and fail. Now there is some very light
validation that the file looks valid, checking that it has a
PackageDescription import, before accepting it, otherwise it keeps
looking.
This replaces many instances of `fatalError` with `XCTFail`. Although
these code paths should not come to pass, there are currently failures
in the test suite on Windows where these trigger. By using `XCTFail`
instead, we allow the tests to continue execution which is helpful for
investigating the current state and make progress towards fixing the
issues.
Previously in the case you have an invalid Package.swift file the LSP
log would just show:
```
[2022-07-12 14:57:23.940] failed to create SwiftPMWorkspace: the package does not contain a buildable target
```
With this change it at least hints you towards where the invalid file
is:
```
[2022-07-12 15:00:45.106] failed to create SwiftPMWorkspace /Users/ksmiley/dev/oss-swift/swiftpm/Sources/PackageModel: the package does not contain a buildable target
```
Rather than asserting, raise an error for the user and abort the
operation. This is motivated by the desire to get the test suite mostly
working on Windows so that the underlying issues can be worked through
more easily.
- Add typeHierarchyProvider
- Implement prepareTypeHierarchy request
- Add supertype and subtype request handlers
- Implement supertypes and subtypes request
- Display location and conformance of extensions in type hierarchy
- Include extensions in the type hierarchy
- Include module names in type hierarchy
Windows uses `Path` for the environment variable spelling, but expects
that environment variables are case-insensitive. Foundation's
implementation treats the environment variables as being case sensitive
and will not properly look up the value Add a case corrected spelling
for that support.
- Set up infrastructure for call hierarchy tests
- Add test case for call hierarchy
- Fix call hierarchy test by querying usr
- Test incoming call hierarchy too
- Add prepareCallHierarchy handler
- Register callHierarchyProvider capability
- Use proper symbol kind in prepareCallHierarchy
- Stub out implementation of outgoingCalls
- Encode usr and uri in indexToLSPCallHierarchyItem
- Extract call hierarchy item data parser
- Implement incomingCalls
- Add Call Hierarchy to the list of supported features
- Resolve caller/callee definition locations for call hierarchy
Instead of having ad-hoc timeout durations in all the test cases, specify a default timeout duration that can be used by tests.
This allows us increase the timeout duration for all tests if we discover that e.g. sourcekitd is slower in CI setups.
rdar://91615376
This allows sourcekit-lsp to make use of the path remappings recently added to
the index store and IndexStoreDB to remap remote paths into local paths
when loading index data locally.
These remappings can be provided via the `-index-prefix-map` command line flag to sourcekit-lsp or via the `BuildSystem` integration point.
We only open a document e.g. with the `FoldingRanges:` prefix to get the document structure as a one-off task, so we should be closing it afterwards.
Fixes#553 (rdar://93154201)
A didChangeWorkspaceFolders notification might cause documents that are already open to now be considered part of a different workspace. To reflect this, close documents whose workspace has changed in the old workspace and re-open them in the new workspace.
rdar://94026341 [#557]
- Use official textDocument/inlayHint request
- Rename InlayHintCategory to InlayHintKind
- Additionally, represent it using an Int, as in the proposed LSP API.
- Add inlay hint client capabilities
- Add inlay hint server capabilities
- Add dynamic registration of inlay hint request
- Rename InlayHintsRequest -> InlayHintRequest
This is to be consistent with the request itself being named in singular
in LSP and the other requests (e.g. DocumentSymbolRequest).
- Forward inlay hint requests to clangd
- Add colon before inlay hints
- Add other properties to InlayHint
- Add InlayHintLabel structures
- Conform InlayHintLabel to ExpressibleByStringX protocols
- Attach TextEdit to inlay hints for committing them
- Add InlayHint.data
- Fix InlayHintTests
We need to include text edits in the expected inlay hints.