Commit Graph

42 Commits

Author SHA1 Message Date
Rintaro Ishizaki
561b1c00fc [Tests] Disable flaky tests in ASAN environment 2023-04-18 10:01:04 -07:00
Alex Hoppen
fcc5d98f1c [CursorInfo] Deliver results from solver-based cursor info
Running the SourceKit stress tester with verification of solver-based cursor info returned quite a few differences but in all of them, the old AST-based implementation was actually incorrect. So, instead of verifying  the results, deliver the results from solver-baesd cursor info and only fall back to AST-based cursor info if the solver-based implementation returned no results.

rdar://103369449
2023-02-07 14:53:54 +01:00
Alexis Laferrière
4aa857c153 [Test] Disable cursor-info.swift on non-asserts builds 2022-12-14 16:08:50 -08:00
Alex Hoppen
a8dd6819b5 [IDE] Implement completion-like cursor info for ValueDecls
This brings up the ability to compute cursor info results using the completion-like type checking paradigm, which an reuse ASTContexts and doesn’t need to type check the entire file.

For now, the new implementation only supports cursor info on `ValueDecl`s (not on references) because they were easiest to implement. More cursor info kinds are coming soon.

At the moment, we only run the new implementation in a verification mode: It is only invoked in assert toolchains and when run, we check that the results are equivalent to the old implementation. Once more cursor info kinds are implemented and if the SourceKit stress tester doesn’t find any verification issues, we can enable the new implementation, falling back to the old implementation if the new one didn’t produce any results.
2022-12-08 14:39:14 +01:00
Erik Eckstein
70981cf95f tests: fix misspelled check prefixes
Fix the common error of using underscores instead of dashes.
In the rebranch this is an error (lit got more picky), but it also makes sense to fix the tests in the main branch
2022-11-08 17:27:48 +01:00
Alex Hoppen
6a4f929b19 [SourceKit] Disable SourceKit/CompileNotifications/diagnostics.swift in ASAN
Disable the test case while we are investigating.
2022-09-28 21:50:48 +02:00
Alex Hoppen
e2ebd2bf72 [SourceKit] Flush llvm::outs() before printing to STDOUT_FILENO in soucekitd-test
Otherwise, we get non-deterministic ordering of results printed through `llvm::outs()` and `STDOUT_FILENO`.
2021-10-13 21:29:18 +02:00
fwcd
9f21b4a2f6 Fix remaining SourceKit tests 2021-05-08 00:40:53 +02:00
fwcd
8d35ed0fe9 Update diags in SourceKit tests to include key.id
- Update SourceKit/DocumentStructure tests
- Update SourceKit/CursorInfo tests
- Update SourceKit/SyntaxMapData tests
- Update SourceKit/Sema tests
- Update SourceKit/CompileNotifications tests
2021-05-07 19:32:04 +02:00
David Goldman
67a2fe494a Fix up compile operation kind
- `key.compile_operation` instead of `key.compileoperation`
- Make the operation kind optional (nothing emitted for perform sema)
2020-05-18 13:18:40 -04:00
David Goldman
40759df737 [SourceKit] Include operation kind in compile notifications
- Compile will start / did finish now includes the operation
  kind (perform sema or code complete).
- See also
  https://forums.swift.org/t/sourcekit-lsp-file-status-ux/35947
2020-05-15 17:16:30 -04:00
Varun Gandhi
a1716fe2a6 [Diagnostics] Update compiler diagnostics to use less jargon. (#31315)
Fixes rdar://problem/62375243.
2020-04-28 14:11:39 -07:00
Nathan Hawes
b9d5672ca1 [SourceKit] Add a global-configuration request to control SourceKit's behavior around .swiftsourceinfo files
SwiftSourceInfo files provide source location information for decls coming from
loaded modules. For most IDE use cases it either has an undesirable impact on
performance with no benefit (code completion), results in stale locations being
used instead of more up-to-date indexer locations (cursor info), or has no
observable effect (live diagnostics, which are filtered to just those with a
location in the primary file).

For non-IDE clients of SourceKit though, cursor info providing declaration
locations for symbols from other modules is useful, so add a global
configuration option (and a new request to set it) to control whether
.swiftsourceinfo files are loaded or not based on use case (they are loaded by
default).
2019-12-03 13:15:20 -08:00
Rintaro Ishizaki
2564a6e494 [CodeCompletion] Avoid typechecking all toplevel decls in the current file
- Use `performParseAndResolveImportsOnly()` to invoke the frontend
- Do `bindExtensions()` in `ide::typeCheckContextUntil()`
- Typecheck preceding `TopLevelCodeDecl`s only if the compleiton is in
  a `TopLevelCodeDecl`
- Other related tweaks

rdar://problem/56636747
2019-11-12 12:57:18 +09:00
Xi Ge
fd280d7746 sourcekitd-test: ignore .swiftsourcefile when invoking sourcekitd from sourcekitd-test 2019-10-16 14:13:48 -07:00
Ben Langmuir
bd21fb4e65 Merge pull request #26205 from gmittert/YetAnotherPathChange
Handle Windows Paths in CompileNotifications Tests
2019-07-18 11:01:05 -07:00
Gwen Mittertreiner
44cd3ff33d Handle Windows Paths in CompileNotifications Tests
On Windows, JSON output creates paths with `\\` separators, so pass
--enable-yaml-compatibility to handle it properly.
2019-07-17 18:38:29 -07:00
Gwen Mittertreiner
f863c93183 [Windows] Fix SourceKit/CompileNotifications/code-completion.swift
When Windows normalizes paths, it prefixes them with \\?\. Fix the regex
to allow this.
2019-07-17 14:40:22 -07:00
David Goldman
7b6f9499b7 Comment and sourcekitd-test fixes 2019-05-28 04:36:29 -04:00
David Goldman
1b1756cb55 Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-28 04:24:25 -04:00
David Goldman
176cd6cce1 Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-28 04:24:25 -04:00
Joe Groff
7d54810b92 Revert "[SourceKit] Fail requests when an error occurs" 2019-05-22 15:18:28 -07:00
David Goldman
1c819820fa Comment and sourcekitd-test fixes 2019-05-21 10:40:22 -04:00
David Goldman
a3a4d2d22b Add InternalDiagnostic to CursorInfoData and NameTranslatingInfo 2019-05-03 11:01:22 -04:00
David Goldman
10ecea6269 [SourceKit] Fail requests when an error occurs
Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
2019-05-03 11:01:21 -04:00
Rintaro Ishizaki
37bb0492ff [SourceKit] Add trace logging for typecontextinfo request. 2019-01-23 12:10:14 -08:00
Argyrios Kyrtzidis
f913a239f8 [SourceKit] Avoid the 'error: no input files' diagnostic notification for syntactic-only requests
rdar://44989868
2018-10-13 09:48:00 -07:00
Argyrios Kyrtzidis
5fbe069273 [test] Update and re-enable test/SourceKit/CompileNotifications/diagnostics.swift
rdar://39260564
2018-10-11 15:16:36 -07:00
Jordan Rose
9a794531c7 [SourceKit] Honor #sourceLocation in reporting diagnostics 2018-08-29 11:46:41 -07:00
swift-ci
32ed7e2d02 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 12:49:02 -07:00
Ben Langmuir
c3e5d63384 [sourcekit] Send notification if compiler argument parsing fails in editor.open
Since we will not reach `createAST` where we would normally send the
notification, send one from `getInvocation` when it fails.

rdar://39225180
2018-05-29 15:24:20 -07:00
Ben Langmuir
97b735359f [sourcekit] Attempt to provide diagnostics when compilation fails for any reason
Refactors the diagnostic code to be run whenever a compilation
notification has been started and there are diagnostics available in the
consumer. This allows us to capture diagnostics on all exit paths, and
specifically when code-completion fails because of invalid arguments.

Note: the editor.open code path still doesn't report invalid arguments
because it fails before even trying to create an AST.
2018-05-22 12:40:06 -07:00
Ben Langmuir
a35b2d48a3 [code-completion] Sends compile notifications even if argument parsing fails
For now we don't get a diagnostic, but at least there is a will-compile
containing the arguments.
2018-05-22 11:38:57 -07:00
swift-ci
385c223177 Merge remote-tracking branch 'origin/master' into master-next 2018-04-20 14:49:40 -07:00
Ben Langmuir
8ea2d0dded [BatchMode] Avoid spurious warnings in sourcekitd and indexing
Explicitly disable batch mode in createCompilerInvocation, since it uses
-force-single-frontend-invocation.  Previously we were getting spurious
warnings.  Also add a test that -disable-batch-mode will allow commands
that use -index-file to avoid the same warning, since that is likely
what they want to do as well.

rdar://39581506
2018-04-20 11:28:13 -07:00
swift-ci
6cc68b46e7 Merge remote-tracking branch 'origin/master' into master-next 2018-04-19 22:09:52 -07:00
Ben Langmuir
23ab43c941 [sourcekitd] Change compile notifications to pass a single args string
... instead of an array of compiler arguments. This is good enough
for seeing what's going on, and it saves significant time for long
argument strings, because it doesn't create and destroy so many
xpc strings, and more of the string copying that happens is on a large
contiguous string instead of many small strings.

rdar://39538847
2018-04-19 13:59:27 -07:00
Michael Gottesman
dd7720a024 Disable two failing tests.
rdar://39260564
2018-04-07 10:15:02 -07:00
Ben Langmuir
969f0f41f4 [sourcekitd] Capture diagnostics with invalid locations for compile notifications
Stop filtering out diagnostics with invalid locations in the editor
diagnostic consumer, and instead capture them separately so that we can
include them in did-compile notifications.

rdar://39225000
2018-04-06 11:36:01 -07:00
Ben Langmuir
8c4c1863fc [sourcekit] Include diagnostics from code-completion in notification
The only interesting change here is that I stopped filtering out
non-note diagnostics from outside the "inputs".  This matches better how
code-completion gets inputs, and shouldn't hurt anything else since only
the tracing code will look at diagnostics that aren't in specific
buffers anyway.

rdar://38438512
2018-03-30 16:33:19 -07:00
Ben Langmuir
b78987a8c5 [sourcekit] Add diagnostics to compile notification callback
Compilations can now pass captured diagnostics as part of the
did-compile notification, and this was added to the SwiftASTManager.

rdar://38438512
2018-03-30 16:07:51 -07:00
Ben Langmuir
79d641d89b [sourcekit] Add optional compile notifications
When enabled, send a notification before/after every "compilation",
which for now means `performSema`. This piggy-backs and modifies some
existing code that we had for "tracing" operations in sourcekitd that
unfortunately was untested.  At least now some of the basic parts are
tested via the new notifications.

Part of rdar://38438512
2018-03-29 14:59:30 -07:00