-
Notifications
You must be signed in to change notification settings - Fork 763
Use LocationLink in go to definition
#1884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Purpose: Switch go to definition and go to type definition to return LocationLinks (with originSelectionRange) and extend fourslash baseline infrastructure to capture (optionally) the origin selection range, mirroring Strada behavior — including its known quirk of only showing the origin selection range when no definition appears in the same file.
Key changes:
- LanguageService and LSP server updated to pass and honor client definition capabilities, producing LocationLinks when supported.
- Fourslash harness enhanced (new default definition capabilities, updated VerifyBaselineGoToDefinition signature, baseline generation logic, conversion script adjustments) to optionally include the origin selection range.
- Widespread baseline test updates to reflect new [| |] origin selection markers and modified API usage.
Reviewed Changes
Copilot reviewed 266 out of 266 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/fourslash/goToDefinition/importTypeNodeGoToDefinition.baseline.jsonc | Baseline updated to include origin selection ranges for import type nodes. |
| testdata/baselines/reference/fourslash/goToDefinition/goToTypeDefinition4.baseline.jsonc | Adds origin selection range for type definition reference. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionTypeOnlyImport.baseline.jsonc | Adds origin selection range for type-only import symbol. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSimple.baseline.jsonc | Marks origin selection ranges on constructor calls. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionSignatureAlias_require.baseline.jsonc | Adds origin selection range for require alias references. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionShorthandProperty01.baseline.jsonc | Adds origin selection range for shorthand property. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionOverriddenMember8.baseline.jsonc | Marks override keyword origin selection. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionMultipleDefinitions.baseline.jsonc | Wraps multi-part marker span with selection markers. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionJsxNotSet.baseline.jsonc | Adds origin selection for JSX component reference. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionJsModuleNameAtImportName.baseline.jsonc | Adds origin selection range for JS module import name references. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionJsModuleName.baseline.jsonc | Adds origin selection range for module string literal. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionJsDocImportTag5.baseline.jsonc | Adds selection brackets inside JSDoc import tag parameter type. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionJsDocImportTag4.baseline.jsonc | Adds selection brackets in JSDoc import tag. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImports.baseline.jsonc | Marks origin selection ranges for imported identifiers. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames9.baseline.jsonc | Adds origin selection for destructured import usage. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames8.baseline.jsonc | Adds origin selection around import specifier. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames7.baseline.jsonc | Adds origin selection for default import reference. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames6.baseline.jsonc | Adds origin selection for require alias import. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames5.baseline.jsonc | Adds selection for export alias. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames4.baseline.jsonc | Adds selection for imported alias. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames3.baseline.jsonc | Adds selections for imported class references. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames2.baseline.jsonc | Adds selection for imported class specifier. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames11.baseline.jsonc | Adds selection for destructured require alias. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames10.baseline.jsonc | Same as above for different test variant. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImportedNames.baseline.jsonc | Adds selection for re-export specifier. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionImport1.baseline.jsonc | Adds selection around module string in import. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName9.baseline.jsonc | Adds selection around external module string. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName8.baseline.jsonc | Same pattern for export list. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName7.baseline.jsonc | Same for import list. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName6.baseline.jsonc | Adds selection for star import with pattern. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName3.baseline.jsonc | Adds selection for require module string. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName2.baseline.jsonc | Adds selection for relative module path in require. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionExternalModuleName.baseline.jsonc | Adds selection for relative module path with comment marker. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionDestructuredRequire2.baseline.jsonc | Adds selection for destructured require identifier. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionDestructuredRequire1.baseline.jsonc | Same for util require. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionDecorator.baseline.jsonc | Adds origin selection for decorator identifiers. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionClassConstructors.baseline.jsonc | Adds origin selection for class constructor references. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionCSSPatternAmbientModule.baseline.jsonc | Adds selection around CSS module import string. |
| testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionAcrossMultipleProjects.baseline.jsonc | Adds selection for cross-project reference. |
| testdata/baselines/reference/fourslash/goToDefinition/findAllRefsForDefaultExport.baseline.jsonc | Adds origin selection for default export reference. |
| testdata/baselines/reference/fourslash/goToDefinition/definition01.baseline.jsonc | Adds selection to external module path. |
| testdata/baselines/reference/fourslash/goToDefinition/definition.baseline.jsonc | Same change for variant. |
| testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionSameNameDifferentDirectory.baseline.jsonc | Adds origin selections for class and property in declaration map scenario. |
| testdata/baselines/reference/fourslash/goToDefinition/declarationMapsGoToDefinitionRelativeSourceRoot.baseline.jsonc | Adds origin selection for method name. |
| testdata/baselines/reference/fourslash/goToDefinition/declarationMapGoToDefinition.baseline.jsonc | Adds origin selection for method name (non-relative source root). |
| internal/project/untitled_test.go | Updates ProvideDefinition call to new signature with capabilities param. |
| internal/lsp/server.go | Passes client definition capabilities to LanguageService for definition/typeDefinition. |
| internal/ls/utilities.go | Adds toContextRange helper for context ranges (origin selection support). |
| internal/ls/findallreferences.go | Separates TextRange creation from LSP range construction; renames helper. |
| internal/ls/definition.go | Core logic: ProvideDefinition / ProvideTypeDefinition now produce LocationLinks with originSelectionRange when supported. |
| internal/fourslash/tests/gen/*.go | Numerous test updates: adapt to new VerifyBaselineGoToDefinition signature and origin selection range expectations. |
| internal/fourslash/fourslash.go | Adds default definition capabilities; rewrites VerifyBaselineGoToDefinition to handle LocationLinks and optional origin selection range. |
| internal/fourslash/baselineutil.go | Supports optional additional (origin) location in baselines replicating Strada behavior. |
| internal/fourslash/_scripts/convertFourslash.mts | Script updated to emit new Go calls including originSelectionRange boolean parameter and boundSpan handling. |
DanielRosenwasser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for tackling this!
* Port 'go to type definition' tests (microsoft#1883) * Fix panic in `getTokenAtPosition` for JSDoc type assertions (microsoft#1846) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Co-authored-by: Andrew Branch <andrew@wheream.io> * Don’t look in JSExportAssignment and CommonJSExport for nodes (microsoft#1886) * Fix link in native preview platform packages (microsoft#1838) * fix(1880): No error message for JSDoc type parsing (microsoft#1881) * Add vscode editor issue template (microsoft#1893) Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com> * Add "Report Issue" button to TSGO status bar commands (microsoft#1889) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> * fix(1898): adjust location handling in find-refs (microsoft#1901) * Fix panic of empty string in type reference directive (microsoft#1908) * Consistently error on full circle of circular import aliases (microsoft#1904) * Fix panic in textDocument/onTypeFormatting when tokenAtPosition is nil (microsoft#1845) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Update submodule (microsoft#1913) * Disable create-cache.yml in forks (microsoft#1912) * Forbid platform specific package uses in agnostic files (microsoft#1911) * Fix JSDoc comment formatting with tab indentation (microsoft#1900) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Clear local baseline dir in hereby test (microsoft#1921) * Unskip passing fourslash test (microsoft#1922) * Support auto-import completion fourslash tests, fix bugs (microsoft#1917) * Fix JSX indentation in JavaScript output (microsoft#1792) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Implement printAllHelp to fix `tsgo --all` producing no output (microsoft#1843) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Bump the github-actions group across 1 directory with 2 updates (microsoft#1909) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> * Ensure os package is forbidden in lint (microsoft#1924) * Speed up levenshteinWithMax by reusing buffers (microsoft#1823) * Fix incorrect formatting for comments inside multi-line argument lists and method chains (microsoft#1929) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Handle nil end position in getMappedLocation (microsoft#1920) * Fix formatter adding extra space at end of line without trailing newline (microsoft#1933) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Fix vscode issue template (microsoft#1934) * userpreferences parsing/ls config handing (microsoft#1729) * Plumb through TokenFlagsSingleQuote; use for auto import quote detection (microsoft#1937) * Invalidate caches on batches of 1000+ watch changes (microsoft#1869) * Create clickable links in quick info from @link JSDoc tags (microsoft#1935) * Don't report errors on `{@link foo.bar}` references (microsoft#1941) * Fix crash in `invocationErrorRecovery` function (microsoft#1944) * Fix leading source file comment emit bugs (microsoft#1945) * Implement selection ranges (microsoft#1939) * Fix porting bug in isArgumentAndStartLineOverlapsExpressionBeingCalled (microsoft#1948) * Add Range to Hover (microsoft#1489) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> * Properly handle hovering on `this` (microsoft#1953) * Bump the github-actions group across 1 directory with 2 updates (microsoft#1959) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixed document highlight for reference directive (microsoft#1951) * Several fixes to JS typing of functions and methods (microsoft#1960) * Update submodule, port 6.0 options defaults (microsoft#1961) * Reapply microsoft#1951 and microsoft#1960 after bad merge (microsoft#1964) Co-authored-by: Anders Hejlsberg <andersh@microsoft.com> Co-authored-by: John Favret <64748847+johnfav03@users.noreply.github.com> * Update submodule with ES5 removals (microsoft#1963) * Actually transform KindCommonJSExport in declaration emit (microsoft#1962) * Quick Info fixes (microsoft#1971) * Fix various named enum types (microsoft#1973) * Move change tracker, converters, utils to separate packages (microsoft#1977) * Consistent rules for mixing `@type`, `@param`, `@return`, `@template` (microsoft#1979) * Check for identifier before obtaining text of name (microsoft#1984) * Respect client capabilities for diagnostics (microsoft#1980) * Store explicitly declared members ahead of inherited members (microsoft#1987) * Add --checkers to control number of checkers per Program (microsoft#1985) * Export all types referenced through other exported APIs, enforce (microsoft#1978) * Switch custom runners from mariner-2.0 to azure-linux-3 (microsoft#1989) * Use `LocationLink` in go to definition (microsoft#1884) * Use a different set of commands to detect fourslash test updates (microsoft#1923) * Skip erasableSyntaxOnly checks for JavaScript files (microsoft#1956) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Update submodule for new cherry-picks (microsoft#1996) * Port TypeScript PR #62604: Propagate variance reliability (microsoft#1916) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> * Only export `@typedef` type aliases in modules (microsoft#1999) * Bump github/codeql-action from 4.31.0 to 4.31.2 in the github-actions group across 1 directory (microsoft#2005) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Hoist @typedef and @import tags to containing scopes that permit them (microsoft#2003) * Remove concept of "unsupported extensions", clean up test skips (microsoft#2004) * Update golangci-lint, fix issues, modernize (microsoft#1981) * Implement more handling of client capabilities (microsoft#1998) * Add docs to signature help (microsoft#2009) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix unused identifier diags, LSP tag diags (microsoft#2007) * fix(2015): abstract property created, overshadowing override (microsoft#2016) * Always check refCount after acquiring lock (microsoft#1986) * Delete resolver unit tests (microsoft#2008) * Fix missing parent for `Expression` in `TypeParameterDeclaration` (microsoft#2017) * Add missing nil check in `getCompletionItemActions` (microsoft#2018) * Fix crash in find-all-refs on `exports.xxx` in .js file (microsoft#2023) * Properly include JSX attributes in find-all-references (microsoft#2025) * Fix crash by removing `getNameFromImportDeclaration` in favor of `Node.Name()` (microsoft#2027) * Fix losing options from command line in watch mode (microsoft#2024) * Add issue investigator agent (microsoft#2030) * Switch 1ESPT pipelines to 1ESPT-AzureLinux3 (microsoft#2031) * Port inlay hints (microsoft#1705) * Split "use strict" into separate transformer, fix bugs with prologues (microsoft#2028) Co-authored-by: Sheetal Nandi <shkamat@microsoft.com> * Use a more cross-architecture-friendly devcontainer image. (microsoft#2034) * Fix nil pointer dereference in range formatting (microsoft#1993) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Port missing `checkJs` logic (microsoft#2046) * Ignore reparsed nodes when determining external module indicator (microsoft#2044) * Fix various fuzzer-caught crashes in the parser (microsoft#2038) * Fix moduleDetection for node18, fix __esModule in detect=force (microsoft#2045) * Fix panic in syncmap on loading nil (microsoft#2056) * Use accessors on `Node` instead of casts and field accesses (microsoft#2052) * Add locks on concurrent alias following checker accesses under incremental mode (microsoft#2051) * Don't add `export` modifier to `JSTypeAliasDeclaration` from `@callback` (microsoft#2063) * Introduce GetECMALineOfPosition to avoid unused rune counting (microsoft#2065) * Don't add `export` modifier to `KindCommonJSExport` reparsed nodes (microsoft#2066) * Fix panic in inlay hints for tuple types (microsoft#2040) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Accurately recognize fourslash test as submodule (microsoft#2068) * Implement auto-import code actions, port tests and fix some bugs (microsoft#2053) * Port tsc --init (microsoft#2033) * Make CheckerPool iteration concurrent by default (microsoft#2070) * Use Microsoft build of Go in CI (microsoft#2069) * Detect Windows junctions with GetFileAttributesEx (microsoft#2013) * Fix CI cache workflow (microsoft#2071) * Use information from contextual type in hovers/quick info (microsoft#2073) * fix(2074): No quick info on function and other similar tokens (microsoft#2078) * Unify locks used on checkers between exclusive pool borrows and EmitResolver scopes (microsoft#2080) * Port non-baseline diagnostics tests (microsoft#2079) * Use SkipTrivia instead of GetRangeOfTokenAtPosition where possible (microsoft#2089) * Move unreachable checks to checker, allowing more AST reuse (microsoft#2067) * Fix scanning of valid surrogate pairs (microsoft#2032) * Fix misplaced parentheses in `Checker.isIndirectCall` (microsoft#2093) * Various agent mode updates (microsoft#2094) * Handle configuration changes in LSP for 'typescript.*' options. (microsoft#2088) * Fix nil pointer dereference in getAdjustedLocation for type-only exports (microsoft#2090) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Fix nil pointer dereference in code actions when diagnostic code is nil (microsoft#2091) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> * Fully resolve LSP client caps to non-pointers, pass by context (microsoft#2095) * Fix hover on `module.exports` (microsoft#2098) * Accept and document jsdoc diffs, round 1 (microsoft#1426) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> * Port baseline diagnostics tests (microsoft#2097) * Clean up disk space in CI before running (microsoft#2103) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add GOBIN to PATH in CI (microsoft#2105) * Make client requests type safe, unmarshal (microsoft#2099) * Display inherited JSDoc documentation in quick info (microsoft#2111) * Sort failingTests and manualTests in en-US (microsoft#2113) * fix(2047): Incomplete declaration emit of callback tag with no return tag (microsoft#2100) * Fix canHaveSyntheticDefault (microsoft#2101) * Misc fixes (microsoft#2112) * chore: fix incorrect function name in comment (microsoft#2109) Signed-off-by: weifangc <weifangcheng@outlook.jp> * Fix typedef binding with CJS `exports=` (microsoft#826) * Provide Program diagnostics as push diags in tsconfig.json (microsoft#2118) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update dependencies (microsoft#2116) * Remove copilot-setup-steps env var (microsoft#2124) * Fix panic on negative parameterIndex in type predicate flow analysis (microsoft#2122) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> Co-authored-by: Ryan Cavanaugh <ryanca@microsoft.com> * Port tests for go to implementation and diff definitions tests (microsoft#2130) * Partially fix multi-checker diagnostics consistency (microsoft#2134) * Implement reportStyleChecksAsWarnings (microsoft#2132) * Include docs on resolved client caps (microsoft#2135) * Fix dynamic import grammar check (microsoft#2138) * Refine LSP with our own types, generate more stuff (microsoft#2141) * Display all symbol meanings in quick info (microsoft#2144) * Multiproject requests like find all refs, rename and workspace symbols (microsoft#1991) * Add stringer-alike String methods to non-string LSP enums (microsoft#2148) * Enable localization (microsoft#2123) * Port workspace symbols tests (microsoft#2146) * Update readme, issue template (microsoft#2140) * Ignore config port (microsoft#1755) * fix(2157): jsdocfunction param is inferred as implicit any when directly assigned to module.exports (microsoft#2158) * fixes after merge * some more fixes * more errors * builds * fmt * fix nil pointer deref * fix error messages --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: weifangc <weifangcheng@outlook.jp> Co-authored-by: Gabriela Araujo Britto <garaujobritto@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com> Co-authored-by: Andrew Branch <andrew@wheream.io> Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com> Co-authored-by: Oleksandr T. <oleksandr.tarasiuk@outlook.com> Co-authored-by: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com> Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> Co-authored-by: Twacqwq <69360546+Twacqwq@users.noreply.github.com> Co-authored-by: Anders Hejlsberg <andersh@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Isabel Duan <isabelduan@microsoft.com> Co-authored-by: John Favret <64748847+johnfav03@users.noreply.github.com> Co-authored-by: Wesley Wigham <wwigham@gmail.com> Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: xu0o0 <hq.xu0o0@gmail.com> Co-authored-by: Sheetal Nandi <shkamat@microsoft.com> Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Co-authored-by: weifangc <weifangcheng@outlook.jp> Co-authored-by: Ryan Cavanaugh <ryanca@microsoft.com> Co-authored-by: Nathan Whitaker <nathan@deno.com>
This PR makes go to definition and go to type definition use
LocationLinks, which has roughly the same shape of what we return in Strada.It also adds support for location link's origin selection range in the baseline tests. In Strada, we had two
verify.baseline...methods for go to def, one which included the origin selection range (response body'stextSpan), and one which did not, so now we do the same here.The origin selection range also shows up in baselines, although in a buggy way: it only shows up if there are no definition locations in the same file. I believe this is a bug in Strada's fourslash, but I've preserved the behavior so it's easier to compare the baselines. Another oddity here is that Strada's fourslash does not use the
contextSpanproperty of definitions in the baselines, even though baselines for e.g. rename do use context spans (they show up as<| ... |>in baselines).I'll enable go to def baseline diffs in another PR, and this PR also helps reduce noise in the diffs.
Fixes #1439