ttsc 0.31.4 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmd/ttsc/compiler_argument_cwd_test.go +38 -38
- package/cmd/ttscserver/main.go +2 -12
- package/cmd/ttscserver/resolve_launch_uses_native_flag_authority_test.go +7 -7
- package/driver/lsp.go +4 -43
- package/driver/rewrite.go +1 -1
- package/internal/e2etrace/completion_hints.go +3 -3
- package/internal/e2etrace/completion_hints_test.go +26 -12
- package/internal/graph/build.go +5 -6
- package/internal/graph/graph.go +3 -3
- package/internal/graph/line_model.go +2 -35
- package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +13 -36
- package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +9 -3
- package/internal/lspserver/lsp_plugin.go +19 -0
- package/internal/lspserver/lsp_proxy.go +9 -129
- package/internal/lspserver/lsp_server.go +0 -8
- package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +6 -36
- package/internal/sourceprocess/windows_target_owns_suspended_admission_test.go +5 -5
- package/lib/compiler/internal/build/BuildExecution.js +11 -3
- package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
- package/lib/compiler/internal/build/TsgoArguments.js.map +1 -1
- package/lib/compiler/internal/project/CompilerProjectSelection.d.ts +9 -8
- package/lib/compiler/internal/project/CompilerProjectSelection.js +11 -9
- package/lib/compiler/internal/project/CompilerProjectSelection.js.map +1 -1
- package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +20 -8
- package/lib/compiler/internal/project/resolveOwningProjectConfig.js +21 -12
- package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -1
- package/lib/compiler/internal/runSingleFileEmit.d.ts +5 -4
- package/lib/compiler/internal/runSingleFileEmit.js +5 -4
- package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
- package/lib/flags/ParseOptions.d.ts +2 -2
- package/lib/internal/E2ETrace.d.ts +1 -0
- package/lib/internal/E2ETrace.js.map +1 -1
- package/lib/internal/OwnedNativeProcess.d.ts +2 -2
- package/lib/internal/OwnedNativeProcess.js +2 -2
- package/lib/internal/SourceNativeRetirement.d.ts +8 -7
- package/lib/internal/SourceNativeRetirement.js +19 -10
- package/lib/internal/SourceNativeRetirement.js.map +1 -1
- package/lib/internal/TtsxNodeOptions.d.ts +79 -0
- package/lib/internal/TtsxNodeOptions.js +121 -0
- package/lib/internal/TtsxNodeOptions.js.map +1 -0
- package/lib/internal/javascriptRuntimeCapabilities.js +4 -1
- package/lib/internal/javascriptRuntimeCapabilities.js.map +1 -1
- package/lib/internal/parseWindowsDirectoryCaseSensitivity.d.ts +5 -5
- package/lib/internal/parseWindowsDirectoryCaseSensitivity.js +5 -5
- package/lib/internal/pathIdentity/createCaseSensitivityObservations.d.ts +35 -0
- package/lib/internal/pathIdentity/createCaseSensitivityObservations.js +209 -0
- package/lib/internal/pathIdentity/createCaseSensitivityObservations.js.map +1 -0
- package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js +2 -143
- package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js.map +1 -1
- package/lib/internal/probeLocalProcess.d.ts +5 -1
- package/lib/internal/probeLocalProcess.js +9 -7
- package/lib/internal/probeLocalProcess.js.map +1 -1
- package/lib/internal/projectInputPathIdentity.d.ts +1 -0
- package/lib/internal/projectInputPathIdentity.js +1 -0
- package/lib/internal/projectInputPathIdentity.js.map +1 -1
- package/lib/launcher/internal/parseTtsxCLI.d.ts +5 -4
- package/lib/launcher/internal/parseTtsxCLI.js +5 -4
- package/lib/launcher/internal/parseTtsxCLI.js.map +1 -1
- package/lib/launcher/internal/prepareExecution.js.map +1 -1
- package/lib/launcher/internal/resolveSingleFileOutput.d.ts +8 -9
- package/lib/launcher/internal/resolveSingleFileOutput.js +8 -9
- package/lib/launcher/internal/resolveSingleFileOutput.js.map +1 -1
- package/lib/launcher/internal/runTtsc.js +5 -5
- package/lib/launcher/internal/runTtsx.js +5 -2
- package/lib/launcher/internal/runTtsx.js.map +1 -1
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.d.ts +2 -0
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js +2 -1
- package/lib/launcher/internal/runtime/ProcessOwnedDirectory.js.map +1 -1
- package/lib/launcher/internal/runtime/RuntimeEntrySources.d.ts +40 -0
- package/lib/launcher/internal/runtime/RuntimeEntrySources.js +57 -0
- package/lib/launcher/internal/runtime/RuntimeEntrySources.js.map +1 -0
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.d.ts +5 -4
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js +8 -6
- package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js.map +1 -1
- package/lib/launcher/internal/runtime/commonJsExportNames.d.ts +2 -1
- package/lib/launcher/internal/runtime/commonJsExportNames.js +2 -1
- package/lib/launcher/internal/runtime/commonJsExportNames.js.map +1 -1
- package/lib/launcher/internal/runtime/installRuntimeHooks.js +35 -9
- package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
- package/lib/launcher/internal/runtime/isLocalProcessGone.d.ts +1 -1
- package/lib/launcher/internal/runtime/isLocalProcessGone.js +4 -4
- package/lib/launcher/internal/runtime/isLocalProcessGone.js.map +1 -1
- package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js +3 -1
- package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js.map +1 -1
- package/lib/launcher/internal/watch/FseventsStreams.d.ts +2 -0
- package/lib/launcher/internal/watch/FseventsStreams.js +19 -0
- package/lib/launcher/internal/watch/FseventsStreams.js.map +1 -1
- package/lib/launcher/internal/watch/WatchTopology.d.ts +74 -12
- package/lib/launcher/internal/watch/WatchTopology.js +301 -92
- package/lib/launcher/internal/watch/WatchTopology.js.map +1 -1
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.d.ts +4 -1
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js +3 -2
- package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js.map +1 -1
- package/lib/plugin/internal/load/loadProjectPlugins.js +17 -9
- package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
- package/lib/plugin/internal/load/resolveNativeSource.js +2 -3
- package/lib/plugin/internal/load/resolveNativeSource.js.map +1 -1
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.d.ts +4 -1
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js +9 -2
- package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js.map +1 -1
- package/lib/structures/internal/TtscCommonOptions.d.ts +2 -2
- package/package.json +9 -9
- package/src/compiler/internal/build/BuildExecution.ts +15 -6
- package/src/compiler/internal/build/TsgoArguments.ts +4 -1
- package/src/compiler/internal/project/CompilerProjectSelection.ts +14 -14
- package/src/compiler/internal/project/resolveOwningProjectConfig.ts +29 -14
- package/src/compiler/internal/runSingleFileEmit.ts +11 -7
- package/src/flags/ParseOptions.ts +2 -2
- package/src/internal/E2ETrace.ts +5 -1
- package/src/internal/OwnedNativeProcess.ts +2 -2
- package/src/internal/SourceNativeRetirement.ts +42 -19
- package/src/internal/TtsxNodeOptions.ts +124 -0
- package/src/internal/javascriptRuntimeCapabilities.ts +6 -1
- package/src/internal/parseWindowsDirectoryCaseSensitivity.ts +5 -5
- package/src/internal/pathIdentity/createCaseSensitivityObservations.ts +242 -0
- package/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts +2 -169
- package/src/internal/probeLocalProcess.ts +13 -8
- package/src/internal/projectInputPathIdentity.ts +1 -0
- package/src/launcher/internal/parseTtsxCLI.ts +5 -4
- package/src/launcher/internal/prepareExecution.ts +4 -1
- package/src/launcher/internal/resolveSingleFileOutput.ts +8 -9
- package/src/launcher/internal/runTtsc.ts +5 -5
- package/src/launcher/internal/runTtsx.ts +17 -8
- package/src/launcher/internal/runtime/ProcessOwnedDirectory.ts +5 -1
- package/src/launcher/internal/runtime/RuntimeEntrySources.ts +57 -0
- package/src/launcher/internal/runtime/RuntimeProjectOwnership.ts +23 -10
- package/src/launcher/internal/runtime/commonJsExportNames.ts +11 -4
- package/src/launcher/internal/runtime/installRuntimeHooks.ts +55 -13
- package/src/launcher/internal/runtime/isLocalProcessGone.ts +5 -3
- package/src/launcher/internal/runtime/resolveRuntimeCleanTargets.ts +17 -5
- package/src/launcher/internal/watch/FseventsStreams.ts +22 -0
- package/src/launcher/internal/watch/WatchTopology.ts +387 -99
- package/src/launcher/internal/watch/projectInputReloadEventShouldNotify.ts +14 -9
- package/src/plugin/internal/load/loadProjectPlugins.ts +17 -3
- package/src/plugin/internal/load/resolveNativeSource.ts +10 -4
- package/src/plugin/internal/source/pluginModuleReplaceDirectories.ts +10 -1
- package/src/structures/internal/TtscCommonOptions.ts +2 -2
- package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +0 -78
- package/internal/graphsymbols/provider.go +0 -650
- package/internal/lspserver/lsp_symbols.go +0 -212
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
package lspserver
|
|
2
|
-
|
|
3
|
-
// lsp_symbols.go lets the proxy answer two language methods from a local
|
|
4
|
-
// SymbolProvider computed off ttsc's compiler-backed code graph (see
|
|
5
|
-
// internal/graphsymbols): textDocument/documentSymbol and
|
|
6
|
-
// textDocument/references. The wrapped tsgo LSP implements both itself, so the
|
|
7
|
-
// proxy forwards to tsgo whenever it advertises the capability and only answers
|
|
8
|
-
// locally as a fallback or when a consumer opts into the graph answers (see
|
|
9
|
-
// shouldAnswerDocumentSymbolLocally / shouldAnswerReferencesLocally).
|
|
10
|
-
|
|
11
|
-
import "encoding/json"
|
|
12
|
-
|
|
13
|
-
// LSPSymbolKind mirrors the LSP SymbolKind enum. Only the members the graph's
|
|
14
|
-
// node kinds map onto are named here; the numeric values are the wire contract.
|
|
15
|
-
//
|
|
16
|
-
// @evidence contracts/common.md#principled-implementation Integer discriminants retain LSP SymbolKind values while naming the graph-supported subset.
|
|
17
|
-
// @evidence contracts/common.md#clear-and-simple-design One enum serves hierarchy and usage results without compiler node dependencies.
|
|
18
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts Named values are protocol constants rather than guessed graph outputs.
|
|
19
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose explains the supported subset and numeric wire meaning, following the documentation skill.
|
|
20
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
|
|
21
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
|
|
22
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
23
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
|
|
24
|
-
type LSPSymbolKind int
|
|
25
|
-
|
|
26
|
-
const (
|
|
27
|
-
LSPSymbolKindClass LSPSymbolKind = 5
|
|
28
|
-
LSPSymbolKindMethod LSPSymbolKind = 6
|
|
29
|
-
LSPSymbolKindEnum LSPSymbolKind = 10
|
|
30
|
-
LSPSymbolKindInterface LSPSymbolKind = 11
|
|
31
|
-
LSPSymbolKindFunction LSPSymbolKind = 12
|
|
32
|
-
LSPSymbolKindVariable LSPSymbolKind = 13
|
|
33
|
-
LSPSymbolKindStruct LSPSymbolKind = 23
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
// LSPDocumentSymbol is the hierarchical shape returned by
|
|
37
|
-
// textDocument/documentSymbol. Range spans the whole declaration and
|
|
38
|
-
// SelectionRange identifies the contained navigation span. The graph provider
|
|
39
|
-
// uses the whole declaration span for both because it lacks a separate name
|
|
40
|
-
// span. Children nest members (a class's methods) under their owner.
|
|
41
|
-
//
|
|
42
|
-
// @evidence contracts/common.md#principled-implementation Whole and selection ranges remain distinct while recursive Children represent declaration ownership.
|
|
43
|
-
// @evidence contracts/common.md#clear-and-simple-design The hierarchical result reuses ranges and kinds without mixing query state into nodes.
|
|
44
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts The graph supplies actual names and ranges; the shape does not encode expected declarations.
|
|
45
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose documents selection containment and child ownership, following the documentation skill.
|
|
46
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
|
|
47
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
|
|
48
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
49
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
|
|
50
|
-
type LSPDocumentSymbol struct {
|
|
51
|
-
// Name is the declaration's display name.
|
|
52
|
-
Name string `json:"name"`
|
|
53
|
-
|
|
54
|
-
// Kind classifies the declaration using LSP SymbolKind discriminants.
|
|
55
|
-
Kind LSPSymbolKind `json:"kind"`
|
|
56
|
-
|
|
57
|
-
// Range covers the declaration in session UTF-16 coordinates.
|
|
58
|
-
Range LSPRange `json:"range"`
|
|
59
|
-
|
|
60
|
-
// SelectionRange is contained in Range and need not isolate the name.
|
|
61
|
-
SelectionRange LSPRange `json:"selectionRange"`
|
|
62
|
-
|
|
63
|
-
// Children nest owned declarations; an empty list is omitted.
|
|
64
|
-
Children []LSPDocumentSymbol `json:"children,omitempty"`
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// LSPLocation is the wire shape of an LSP Location: a range inside a document,
|
|
68
|
-
// returned by textDocument/references for each usage site.
|
|
69
|
-
//
|
|
70
|
-
// @evidence contracts/common.md#principled-implementation URI plus range identifies a usage independently of the document currently open in the editor.
|
|
71
|
-
// @evidence contracts/common.md#clear-and-simple-design Reference results and related diagnostics share this location value.
|
|
72
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts Locations are producer values rather than guessed local filenames.
|
|
73
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose describes document usage sites, following the documentation skill.
|
|
74
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
|
|
75
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
|
|
76
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
77
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
|
|
78
|
-
type LSPLocation struct {
|
|
79
|
-
// URI identifies the target document using protocol spelling.
|
|
80
|
-
URI string `json:"uri"`
|
|
81
|
-
|
|
82
|
-
// Range locates the site in that document's session UTF-16 coordinates.
|
|
83
|
-
Range LSPRange `json:"range"`
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// SymbolProvider computes documentSymbol and references locally from ttsc's
|
|
87
|
-
// compiler-backed code graph. tsgo implements both methods too, so the proxy
|
|
88
|
-
// consults a provider only as a fallback or when a consumer opts into the graph
|
|
89
|
-
// answers; see shouldAnswerDocumentSymbolLocally / shouldAnswerReferencesLocally.
|
|
90
|
-
//
|
|
91
|
-
// Implementations may load a compiler Program lazily and must be safe to call
|
|
92
|
-
// from multiple goroutines. DocumentSymbols and References run in separate
|
|
93
|
-
// query goroutines rather than on the editor pump. Their replies still share
|
|
94
|
-
// frame serialization, and this does not bound custom provider work or the
|
|
95
|
-
// synchronous invalidation call.
|
|
96
|
-
//
|
|
97
|
-
// @evidence contracts/common.md#principled-implementation Hierarchy, usage lookup and invalidation are separate operations over the provider's compiler-backed state.
|
|
98
|
-
// @evidence contracts/common.md#clear-and-simple-design The proxy depends on semantic queries without exposing graph construction or program storage.
|
|
99
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts Supported injection supplies local answers without replacing upstream symbol methods.
|
|
100
|
-
// @evidence contracts/common.md#meaningful-documentation Native paragraphs document fallback selection and concurrent invocation, following the documentation skill.
|
|
101
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources A type declaration acquires and holds no runtime resource.
|
|
102
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms A type declaration chooses no processing strategy.
|
|
103
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work A type declaration computes nothing, so there is no work to share.
|
|
104
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation This type declaration describes a data shape only; it opens no file, builds no path and branches on no platform.
|
|
105
|
-
type SymbolProvider interface {
|
|
106
|
-
// DocumentSymbols returns the declarations in the document identified by uri
|
|
107
|
-
// as a hierarchy of LSPDocumentSymbol. A document with no declarations
|
|
108
|
-
// yields an empty (non-nil) slice.
|
|
109
|
-
//
|
|
110
|
-
// @evidence contracts/common.md#principled-implementation URI selects one document whose declarations form an ownership hierarchy.
|
|
111
|
-
// @evidence contracts/common.md#clear-and-simple-design This query returns wire nodes while the implementation owns compiler loading.
|
|
112
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts Results come through the provider boundary instead of patched upstream methods.
|
|
113
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose states hierarchy and empty-result meaning, following the documentation skill.
|
|
114
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources DocumentSymbols declares a signature only; the implementation owns acquisition and release of resources.
|
|
115
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms DocumentSymbols declares a signature only; the implementation owns the processing strategy.
|
|
116
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work DocumentSymbols declares a signature only; the implementation owns any shared work.
|
|
117
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation DocumentSymbols is a signature without a body here; path and platform behavior belongs to the implementation that supplies it.
|
|
118
|
-
DocumentSymbols(uri string) ([]LSPDocumentSymbol, error)
|
|
119
|
-
|
|
120
|
-
// References returns the usage locations of the symbol at pos in the document
|
|
121
|
-
// identified by uri. includeDeclaration adds the symbol's own declaration to
|
|
122
|
-
// the result. A position that resolves to no symbol yields an empty slice.
|
|
123
|
-
//
|
|
124
|
-
// @evidence contracts/common.md#principled-implementation URI and UTF-16 position select a symbol; includeDeclaration distinguishes declaration sites from usages.
|
|
125
|
-
// @evidence contracts/common.md#clear-and-simple-design The query returns shared location values without exposing symbol identity internals.
|
|
126
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts A missing symbol yields no usages instead of guessed same-name matches.
|
|
127
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose explains declaration inclusion and empty results, following the documentation skill.
|
|
128
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources References declares a signature only; the implementation owns acquisition and release of resources.
|
|
129
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms References declares a signature only; the implementation owns the processing strategy.
|
|
130
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work References declares a signature only; the implementation owns any shared work.
|
|
131
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation References is a signature without a body here; path and platform behavior belongs to the implementation that supplies it.
|
|
132
|
-
References(uri string, pos LSPPosition, includeDeclaration bool) ([]LSPLocation, error)
|
|
133
|
-
|
|
134
|
-
// Invalidate withdraws published cached compiler state from later queries.
|
|
135
|
-
// The proxy calls it on didChange/didSave; an uncached provider may no-op.
|
|
136
|
-
// In-flight queries may still hold an earlier snapshot, and invalidation alone
|
|
137
|
-
// does not certify a new native capture or cancel that work.
|
|
138
|
-
//
|
|
139
|
-
// @evidence contracts/common.md#principled-implementation Invalidation withdraws compiler-backed state before later queries use it.
|
|
140
|
-
// @evidence contracts/common.md#clear-and-simple-design Cache policy stays with the provider that owns the state.
|
|
141
|
-
// @evidence contracts/common.md#prohibited-implementation-shortcuts An uncached provider may legitimately do nothing; a cached provider cannot fake freshness by retaining disproven state.
|
|
142
|
-
// @evidence contracts/common.md#meaningful-documentation Native prose documents triggers and the uncached exception, following the documentation skill.
|
|
143
|
-
// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Invalidate declares a signature only; the implementation owns acquisition and release of resources.
|
|
144
|
-
// @evidenceExclude contracts/performance.md#efficient-algorithms Invalidate declares a signature only; the implementation owns the processing strategy.
|
|
145
|
-
// @evidenceExclude contracts/performance.md#reuse-equivalent-work Invalidate declares a signature only; the implementation owns any shared work.
|
|
146
|
-
// @evidenceExclude contracts/portability.md#os-neutral-implementation Invalidate is a signature without a body here; path and platform behavior belongs to the implementation that supplies it.
|
|
147
|
-
Invalidate()
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// handleDocumentSymbolRequest answers textDocument/documentSymbol from the local
|
|
151
|
-
// SymbolProvider only when shouldAnswerDocumentSymbolLocally says to (no
|
|
152
|
-
// provider wired, upstream tsgo did not advertise the capability, or a consumer
|
|
153
|
-
// forced the local provider). Otherwise it returns false so the request flows to
|
|
154
|
-
// upstream tsgo's compiler-exact handler. The computation runs on its own
|
|
155
|
-
// goroutine (a program load can be slow) so the editor->upstream pump keeps
|
|
156
|
-
// servicing other traffic.
|
|
157
|
-
func (p *Proxy) handleDocumentSymbolRequest(env Envelope) (bool, error) {
|
|
158
|
-
if !p.shouldAnswerDocumentSymbolLocally() {
|
|
159
|
-
return false, nil
|
|
160
|
-
}
|
|
161
|
-
var params struct {
|
|
162
|
-
TextDocument struct {
|
|
163
|
-
URI string `json:"uri"`
|
|
164
|
-
} `json:"textDocument"`
|
|
165
|
-
}
|
|
166
|
-
if err := json.Unmarshal(env.Params, ¶ms); err != nil || params.TextDocument.URI == "" {
|
|
167
|
-
return false, nil
|
|
168
|
-
}
|
|
169
|
-
go p.completeDocumentSymbolRequest(env, params.TextDocument.URI)
|
|
170
|
-
return true, nil
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
func (p *Proxy) completeDocumentSymbolRequest(env Envelope, uri string) {
|
|
174
|
-
symbols, err := p.symbolProvider.DocumentSymbols(uri)
|
|
175
|
-
if err != nil || symbols == nil {
|
|
176
|
-
// A provider failure must not surface as an LSP error to a graph
|
|
177
|
-
// consumer mid-index; reply with an empty result so the client moves on.
|
|
178
|
-
symbols = []LSPDocumentSymbol{}
|
|
179
|
-
}
|
|
180
|
-
p.reportAsyncError(p.writeResult(env.ID, symbols))
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// handleReferencesRequest answers textDocument/references from the local
|
|
184
|
-
// SymbolProvider, mirroring handleDocumentSymbolRequest's gating (via
|
|
185
|
-
// shouldAnswerReferencesLocally) and off-pump-goroutine behavior.
|
|
186
|
-
func (p *Proxy) handleReferencesRequest(env Envelope) (bool, error) {
|
|
187
|
-
if !p.shouldAnswerReferencesLocally() {
|
|
188
|
-
return false, nil
|
|
189
|
-
}
|
|
190
|
-
var params struct {
|
|
191
|
-
TextDocument struct {
|
|
192
|
-
URI string `json:"uri"`
|
|
193
|
-
} `json:"textDocument"`
|
|
194
|
-
Position LSPPosition `json:"position"`
|
|
195
|
-
Context struct {
|
|
196
|
-
IncludeDeclaration bool `json:"includeDeclaration"`
|
|
197
|
-
} `json:"context"`
|
|
198
|
-
}
|
|
199
|
-
if err := json.Unmarshal(env.Params, ¶ms); err != nil || params.TextDocument.URI == "" {
|
|
200
|
-
return false, nil
|
|
201
|
-
}
|
|
202
|
-
go p.completeReferencesRequest(env, params.TextDocument.URI, params.Position, params.Context.IncludeDeclaration)
|
|
203
|
-
return true, nil
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
func (p *Proxy) completeReferencesRequest(env Envelope, uri string, pos LSPPosition, includeDeclaration bool) {
|
|
207
|
-
locations, err := p.symbolProvider.References(uri, pos, includeDeclaration)
|
|
208
|
-
if err != nil || locations == nil {
|
|
209
|
-
locations = []LSPLocation{}
|
|
210
|
-
}
|
|
211
|
-
p.reportAsyncError(p.writeResult(env.ID, locations))
|
|
212
|
-
}
|