Commit Graph

477 Commits

Author SHA1 Message Date
Ben Langmuir
6eb17c9a7b Merge pull request #358 from hlopko/glibc_fix2
Import Glibc in SKDResponse
2020-12-16 09:05:57 -08:00
Ben Langmuir
ee7ef54e9d Merge pull request #345 from owenv/edu-notes-take-2
Expose diagnostic educational notes as diagnostic codes
2020-12-16 07:46:29 -08:00
Marcel Hlopko
35d44e6339 import Glibc in SKDResponse 2020-12-16 13:43:38 +01:00
Marcel Hlopko
3f506c5725 Import glibc 2020-12-15 17:24:37 +01:00
Saleem Abdulrasool
5247a6e540 SKSwiftPMWorkspace: make testBasicCXXArgs pass on Windows
We would previously fail to correctly build the GNU dependency outputs
on Windows since we were checking the file system representation of the
path against the internal path representation.  This fixes the
generation of that command as well as the additional checks in the test
case to allow the test case to succeed on Windows.
2020-11-30 11:44:20 -08:00
Saleem Abdulrasool
36a9c9f645 SKTestSupport: account for executable extensions
Windows uses executable extensions.  Account for them to enable tests to
pass on Windows.
2020-11-30 10:02:14 -08:00
Max Desiatov
cd588d3872 Improve FileSystemError by adding associated path (#348)
Currently `FileSystemError` doesn't have an associated path, which makes diagnosing errors harder. This is going to be fixed in TSC and SwiftPM, but this is a breaking change. Usage of `FileSystemError` is updated in the SourceKit-LSP codebase accordingly.
2020-11-16 20:21:31 +00:00
Owen Voorhees
77a81ad9c1 Expose diagnostic educational notes as diagnostic codes 2020-11-09 18:30:02 -08:00
Boris Bügling
38d2ecca3d Merge pull request #344 from mattt/swiftpm-rename
Rename SwiftPMConfig to Workspace.Configuration
2020-11-03 15:43:12 -08:00
Mattt
84df7d3860 Rename local variable from swiftpmConfiguration to buildConfiguration 2020-11-03 10:30:55 -08:00
Mattt
e4c250b050 Rename SwiftPMConfig to Workspace.Configuration 2020-11-03 10:29:37 -08:00
Ben Langmuir
26f134ff2e Workaround SR-13822 by keeping the file handle alive for the connection
On Linux, the file handle is closing the file descriptor on deinit
despite `closeOnDealloc: false`
(https://bugs.swift.org/browse/SR-13822). Workaround by keping the
FileHandle alive.

rdar://70995458
2020-11-03 10:15:16 -08:00
Ben Langmuir
bb9560f2e2 Merge pull request #341 from compnerd/handling
Fix the Pipe handling on Windows to be correct
2020-11-02 11:56:06 -08:00
Saleem Abdulrasool
6a275d134c Fix the Pipe handling on Windows to be correct
This actually addresses the real issue that was ignored earlier about
pipes on Windows.  The FileHandle cannot provide a non-owning file
descriptor (the returned file descriptor would need to be explicitly
`_close`'d by the receiver).  Foundation now vends a `_handle` accessor
to the OS primitive handle.  Use this to create the dispatch loop for
messaging.  We now create the JSONRPCConnection from handles on Windows
which actually should help enable running some of the tests on Windows
as well.
2020-11-02 09:55:58 -08:00
Joe Heck
c58d6939cc convert tests from #file to using #filePath 2020-10-31 18:29:08 -07:00
David Goldman
3f55178908 Don't log the sourcekit code complete request
Seems to be left over from development; SOURCEKIT_LOGGING is
an alternative to trace this.
2020-10-22 12:27:37 -04:00
Sebastian Fichtner
7a36a51014 Synchronously send error response on message decoding failure (#334)
* Replaces two logs since those don't result in response messages anymore
* Adds a func for sending messages synchronously, to get the two messages out before fatalError
2020-10-16 16:29:46 -07:00
David Goldman
c537c2920e Fix issue where a code-completion session at a specific offset would get stuck failing
- Fix for https://bugs.swift.org/browse/SR-13561 by making sure the
session close waits for the open to finish

- Add a regression test

Change-Id: Iff7217d7b03bc797e036c5329afb0765dcc1874b
2020-10-14 10:50:35 -04:00
flowtoolz
0427823d74 Log error before fatalError(...) when message decoding fails 2020-10-13 15:33:59 +02:00
David Goldman
79795bf4d9 Decrease verbosity of info-level logging (#331)
- Don't log entire LSP notifications/requests for the `info` level, instead log of the form:
  - `Notification<method>` e.g. Notification<textDocument/publishDiagnostics>
  - `Request<method(id)>` e.g. Request<textDocument/hover(6)>
  - `Response<method(id)` e.g. Response<textDocument/hover(6)>

- Only log sourcekitd requests/responses at the debug level
2020-10-08 18:20:56 -04:00
Ben Langmuir
15d47d880e Merge pull request #325 from compnerd/extensions
SKCore: support executable extensions on different platforms
2020-10-08 11:01:15 -07:00
Saleem Abdulrasool
67aaa09d70 build: allow building with dispatch and Foundation from the toolchain
This allows building without dispatch and Foundation build roots, which
allows for a multi-phase build.  This is intended to support the Windows
staged build where dispatch and Foundation are part of the SDK and
SourceKit-LSP is part of the devtools.
2020-10-07 19:08:02 -07:00
David Goldman
482a98893f Log to stderr instead of sending window/logMessage
- clangd itself already logs to stderr so sourcekit-lsp
  should do the same for consistency (unless we want to
  capture clangd's stderr and forward it in the LSP)

- Editors such as VS Code will show stderr output in the same
  output channel where it shows logMessage + traces

Change-Id: Iaf00cffa2e64d8490e21b49a3a9d34a17f54aa9f
2020-10-06 19:18:20 -04:00
Saleem Abdulrasool
3e32ce69f9 SKCore: support executable extensions on different platforms
Similar to the dylib extension, introduce executable extensions.  This
is required for Windows which uses a `.exe` suffix for the executables.
2020-10-05 15:56:35 -07:00
Ben Langmuir
a763252305 [test] Fix resource directory on Linux 2020-10-01 15:19:21 -07:00
Ben Langmuir
41cf3a3764 [test] Put shared test projects INPUTS into bundle resources
This avoids depending on the absolute path to the INPUTS and allows
looking it up at run time even if the tests have moved.
2020-10-01 15:19:21 -07:00
Ben Langmuir
c634ea83ba [test] Move inputsDirectory method from indexstore-db
Minimal change to fix the build.
2020-10-01 11:09:49 -07:00
Saleem Abdulrasool
fe612387b9 SKCore: adjust library loading for Windows
The libIndexStore and sourcekitdInProc DLLs actually reside in the
binaries directory on Windows.  Adjust the paths appropriately for
Windows.  This is required to get the libraries to load correctly.
2020-09-30 14:44:16 -07:00
Saleem Abdulrasool
00d6ae05b4 SKCore: make . part of the extension
This is just a cleanup change to setup the extensions for other targets.
This allows for platforms to have no extensions or an extension which
may or may not include a `.`.
2020-09-29 15:30:29 -07:00
Saleem Abdulrasool
b33a5171cc LanguageServerProtocolJSONRPC: make Windows path work
This adjusts the use of Dispatch to build on Windows.  Windows does not
provide `stdout_fileno` and `stderr_fileno`.  However, it is possible to
use `fileno` to get the associated fileno from the descriptor.

Dispatch on Windows does not deal with fd's but rather with handles.
Convert the file descriptor to a handle and pass that off to dispatch.
The handle is a non-owning reference, and should not be closed.
Fortunately, dispatch does not close the handle when the DispatchIO is
closed.
2020-09-29 13:48:06 -07: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
e7f765747b Fix ExpressibleByArgument conformance on LogLevel
The initializer is failable, not throwing, and there is a default
conformance provided via the integer literal that was not correct.
2020-09-25 14:15:59 -07:00
Ben Langmuir
70d5c6dea2 Update references to 'master' to 'main' 2020-09-23 11:40:42 -07:00
Ben Langmuir
eaea937ee4 Merge pull request #313 from apple/revert-306-patch-1
Revert "Allow double dash for IndexStore-related CLI arguments"
2020-09-08 13:01:52 -07:00
Ben Langmuir
8fe23e65bf Merge pull request #309 from compnerd/build
build: update CMakeLists.txt
2020-09-08 10:22:34 -07:00
Ben Langmuir
e3588aa73b Revert "Allow double dash for IndexStore-related CLI arguments" 2020-09-08 09:34:54 -07:00
Saleem Abdulrasool
c55c71d111 build: update CMakeLists.txt
This updates the CMakeLists.txt to allow building SourceKit-LSP with
CMake.
2020-09-06 18:44:34 -07:00
Saleem Abdulrasool
4e9430c9fb SKSupport: update for BOOL conversion on Windows
We would fail to build on Windows due to the conversion of `BOOL` to
`Bool`, and then comparing to `0`.  This repairs the build on Windows.
2020-09-06 13:11:54 -07:00
Max Desiatov
4fb1a8e961 Allow double dash for IndexStore-related CLI arguments
This is possible thanks to the fix in Argument Parser 0.3.1.
2020-09-02 16:49:14 +01:00
Max Desiatov
58769c50d7 Fix log level option, use single dash in new options 2020-08-27 22:09:43 +01:00
Max Desiatov
51c367c918 Remove unused import 2020-08-27 21:29:11 +01:00
Max Desiatov
fb5e0d4d50 Adopt swift-argument-parser for argument parsing 2020-08-27 21:27:52 +01:00
Ben Langmuir
f50ce7adc1 [gardening] Fix warning about strerror return value
strerror should never return nil, and in the worst case it's already in
a fatalError. Fix the warning about converting an optional value to a
string.
2020-08-05 13:40:55 -07:00
Ben Langmuir
d82c52c003 [logging] Avoid logging cancellation as warnings/errors
Cancellation shows up as an error code, but it is not a real error, so
don't log it like one.

https://bugs.swift.org/browse/SR-13344
2020-08-04 10:04:21 -07:00
Ankit Aggarwal
5aa0a92759 [SKSwiftPMWorkspace] Set swiftpm config file when creating Workspace
This is quite important to set otherwise SourceKit-LSP sets off a wrong
package resolution operation potentially resulting in a wrong swiftpm
package graph.

Ideally, SwiftPM should have APIs that don't force clients to handle all
this configuration but we don't have that today.
2020-08-01 09:20:50 -07:00
Ben Langmuir
16dc2fb0c9 [completion] Enable server-side filtering by default 2020-07-29 11:06:55 -07:00
Ben Langmuir
bbb2a34694 [completion] Add doc comment for CodeCompletionSession 2020-07-29 10:29:20 -07:00
Ben Langmuir
bf9053c671 [gardening] Rename CodeCompletionOptions -> SKCompletionOptions
Since it is being used in the LSP protocol layer, give it a name that
clarifies that it is SourceKit-specific.
2020-07-29 10:01:24 -07:00
Ben Langmuir
90b4381d04 [completion] Add usage note for server-side filtering command-line options 2020-07-29 09:55:23 -07:00
Ben Langmuir
a5832e978b [gardening] Fix copyright headers and formating in modified files 2020-07-29 09:55:02 -07:00