Skip to content

Add Go to Source Definition#3349

Open
jakebailey wants to merge 9 commits intomainfrom
jabaile/go-to-source-1
Open

Add Go to Source Definition#3349
jakebailey wants to merge 9 commits intomainfrom
jabaile/go-to-source-1

Conversation

@jakebailey
Copy link
Copy Markdown
Member

This is significantly different than Strada's in that we are not constructing a whole new program to do this anymore, but instead create a no-dts resolver and then do more stuff manually (in about 700 lines). This does appear to work pretty well. I'm not sure the original method would work anymore with our more-strict JS support.

This includes client-side command stuff like the main TS extension to make this work, however, we now do the "prefer source def" toggle and the "go to def" fallback on the server side.

This includes a bunch more local tests, which were driven by code coverage and comparison against the original code.

(I wasn't intending on actually doing this feature as I have other things I'm supposed to be doing, but, it was a test for something else so, might as well send it I guess.)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “Go to Source Definition” support to the TypeScript-go language server and the preview VS Code extension, including a new custom LSP request, a user preference to prefer source definition when invoking go-to-definition, and extensive fourslash coverage/baselines for the new navigation behavior.

Changes:

  • Implement server-side source-definition resolution (ProvideSourceDefinition) that maps declarations to implementation sources without constructing a new program.
  • Introduce a custom LSP request (custom/textDocument/sourceDefinition) and surface it through server capabilities + extension command/menus.
  • Add/refresh a large suite of fourslash tests and baselines covering module resolution, re-exports, default exports, triple-slash references, and edge cases.

Reviewed changes

Copilot reviewed 152 out of 152 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/ls/sourcedefinition.go New source-definition resolver and entrypoint used by LS to map .d.ts → implementation/source.
internal/ls/definition.go Adds PreferGoToSourceDefinition preference hook to route go-to-definition through source-definition.
internal/ls/lsutil/userpreferences.go Adds PreferGoToSourceDefinition user preference parsing/storage.
internal/lsp/server.go Registers custom source-definition request handler and advertises capability.
internal/lsp/lsproto/_generate/generate.mts Extends protocol generator model with custom request + capability flag.
internal/lsp/lsproto/lsp_generated.go Generated protocol updates for custom request + capability field and method wiring.
internal/fourslash/fourslash.go Adds VerifyBaselineGoToSourceDefinition helper to execute new custom request in tests.
internal/fourslash/baselineutil.go Adds new baseline command + preserves result order for source-definition baselines.
internal/fourslash/_scripts/convertFourslash.mts Enables conversion of verify.baselineGoToSourceDefinition(...) into Go tests.
internal/fourslash/_scripts/unparsedTests.txt Removes prior “unrecognized statement” entries now supported by converter.
internal/fourslash/tests/goToSourceDefinition_test.go New manual fourslash tests for core go-to-source-definition scenarios.
internal/fourslash/tests/goToSourceDefinitionAliasedImportUsage_test.go Tests go-to-source for aliased imports at usage sites (incl. namespace import).
internal/fourslash/tests/goToSourceDefinitionAliasedImportWithPrecedingExports_test.go Tests alias import/re-export when target isn’t first export in implementation file.
internal/fourslash/tests/goToSourceDefinitionDefaultExport_test.go Tests default export navigation variants (named+default, unnamed default, export assignment).
internal/fourslash/tests/goToSourceDefinitionDefaultUsageSite_test.go Tests default import resolution from usage sites via checker path.
internal/fourslash/tests/goToSourceDefinitionEmptyAndMissing_test.go Tests empty JS file + missing default export handling.
internal/fourslash/tests/goToSourceDefinitionImportVariants_test.go Tests require() and dynamic import() module-specifier handling.
internal/fourslash/tests/goToSourceDefinitionImports_test.go Broad import/re-export/cjs defineProperty scenarios for source-definition.
internal/fourslash/tests/goToSourceDefinitionMergedDeclarations_test.go Tests deduping merged declarations (class+namespace).
internal/fourslash/tests/goToSourceDefinitionNestedNodeModules_test.go Tests nested node_modules behavior + fallback paths.
internal/fourslash/tests/goToSourceDefinitionNestedScope_test.go Tests avoiding nested shadowed locals when searching implementation declarations.
internal/fourslash/tests/goToSourceDefinitionNonNodeModulesDts_test.go Tests fallback when .d.ts is outside node_modules and no impl can be found.
internal/fourslash/tests/goToSourceDefinitionPackageResolution_test.go Tests package/subpath mapping logic for implementation resolution.
internal/fourslash/tests/goToSourceDefinitionProperties_test.go Tests property access scenarios incl. mapped types/index signatures.
internal/fourslash/tests/goToSourceDefinitionPropertyAccess_test.go Tests mapped type property navigation (with explicit property presence).
internal/fourslash/tests/goToSourceDefinitionPropertyAccessNoDecl_test.go Tests property access when checker yields no declarations (fallback search).
internal/fourslash/tests/goToSourceDefinitionReExportChain_test.go Tests following forwarded re-export chains to concrete implementation.
internal/fourslash/tests/goToSourceDefinitionScopedPackage_test.go Tests scoped and scoped-@types package mapping to implementations.
internal/fourslash/tests/goToSourceDefinitionTripleSlash_test.go Tests triple-slash reference resolution to JS implementations.
internal/fourslash/tests/goToSourceDefinitionTripleSlashUnresolved_test.go Tests unresolved triple-slash reference returns empty result.
internal/fourslash/tests/goToSourceDefinitionTypeOnlySymbol_test.go Tests type-only symbol fallback to .d.ts and value-import behavior.
internal/fourslash/tests/goToSourceDefinitionTypes_test.go Additional type-only and forwarded non-concrete merge scenarios.
internal/fourslash/tests/goToDefinitionPreferSourceDefinition_test.go Verifies prefer-source-definition changes go-to-definition behavior + fallback.
internal/fourslash/tests/gen/goToSource1_localJsBesideDts_test.go Generated submodule-derived test for go-to-source-definition.
internal/fourslash/tests/gen/goToSource2_nodeModulesWithTypes_test.go Generated submodule-derived test for go-to-source-definition.
internal/fourslash/tests/gen/goToSource3_nodeModulesAtTypes_test.go Generated submodule-derived test for go-to-source-definition.
internal/fourslash/tests/gen/goToSource5_sameAsGoToDef1_test.go Generated submodule-derived test for go-to-source-definition.
internal/fourslash/tests/gen/goToSource6_sameAsGoToDef2_test.go Generated submodule-derived test for go-to-source-definition.
internal/fourslash/tests/gen/goToSource7_conditionallyMinified_test.go Generated submodule-derived test for minified/conditional exports cases.
internal/fourslash/tests/gen/goToSource8_mapFromAtTypes_test.go Generated submodule-derived test for mapping from @types to implementation.
internal/fourslash/tests/gen/goToSource9_mapFromAtTypes2_test.go Generated submodule-derived test for @types mapping + module specifier behavior.
internal/fourslash/tests/gen/goToSource10_mapFromAtTypes3_test.go Generated submodule-derived test for @types mapping scenario.
internal/fourslash/tests/gen/goToSource11_propertyOfAlias_test.go Generated submodule-derived test for property-of-alias navigation.
internal/fourslash/tests/gen/goToSource12_callbackParam_test.go Generated submodule-derived test for callback param navigation to impl.
internal/fourslash/tests/gen/goToSource13_nodenext_test.go Generated submodule-derived test for node16/nodenext resolution.
internal/fourslash/tests/gen/goToSource14_unresolvedRequireDestructuring_test.go Generated submodule-derived test for unresolved require destructuring behavior.
internal/fourslash/tests/gen/goToSource15_bundler_test.go Generated submodule-derived test for bundler mode behavior.
internal/fourslash/tests/gen/goToSource16_callbackParamDifferentFile_test.go Generated submodule-derived test for callback param across files.
internal/fourslash/tests/gen/goToSource17_AddsFileToProject_test.go Generated submodule-derived test for adding file to project during resolution.
internal/fourslash/tests/gen/goToSource18_reusedFromDifferentFolder_test.go Generated submodule-derived test for reuse from different folder scenario.
testdata/baselines/reference/fourslash/state/codeLensAcrossProjects.baseline Baseline updated to include new preference in serialized config state.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToDefinitionPreferSourceDefinition.baseline.jsonc New baseline for go-to-definition preference interaction.
testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionPreferSourceDefinition.baseline.jsonc New go-to-definition baseline showing prefer-source-definition effect.
testdata/baselines/reference/fourslash/goToDefinition/goToDefinitionPreferSourceDefinitionFallback.baseline.jsonc New baseline covering fallback behavior when no source impl exists.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAccessExpressionProperty.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAliasedImportAtUsageSite.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAliasedImportAtUsageSiteNamespaceImport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAliasedImportExport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAliasedImportSpecifier.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAliasedImportWithPrecedingExports.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceAtTypesPackage.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceBarrelReExportChain.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceCallbackParam.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceCallThroughImport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceCJSReExportViaDefineProperty.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceCommonJSAliasPrefersDeclaration.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDeclarationMapFallback.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDeclarationMapSourceMap.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefaultImportNoDefaultInJs.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefaultImportNotFirstStatement.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefaultImportReExportUsage.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefaultImportUsageSiteChecker.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionEmptyJsFile.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionTypeOnlyImportFallsBackToDeclaration.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionTypeOnlyUsageFallsBackToDeclaration.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionUnresolvedTripleSlash.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionValueImportStillWorks.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDtsReExport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDynamicImport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceEmptyNamesEntryFallback.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceExportAssignment.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceExportAssignmentDefault.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceExportAssignmentExpression.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceFallbackToModuleSpecifier.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceFallbacksToDefinitionForInterface.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceFilterPreferredFallbackAll.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceFindImplementationNonNodeModules.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceForwardedNonConcreteMerge.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceForwardedReExportChain.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceImportFilteredByExternalDeclaration.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceIndexSignatureProperty.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceLocalJsBesideDts.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceMappedTypeProperty.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceMappedTypePropertyWithMatch.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceMergedDeclarationDedup.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNamedAndDefaultExport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNamedExportsSpecifier.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNamespaceImportProperty.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNestedClassShadowing.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNestedNodeModules.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNestedScopeShadowing.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNoImplementationFile.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceNonDeclarationFile.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePackageIndexDts.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePackageRootFallsBackToSubpath.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePackageRootThenSubpath.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePropertyAccessDeepChain.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePropertyAccessNamespaceImport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePropertyAccessNoDeclaration.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourcePropertyOfAlias.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReExportAliasWithPrecedingExports.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReExportModuleSpecifier.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReExportNames.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReExportedImplementation.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReferencePathToDts.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceReferenceTypesToJS.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceRequireCall.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceScopedAtTypesPackage.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceScopedPackage.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceSubpathNotIndex.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceTripleSlashReference.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceTypeOnlySymbolFallback.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceUnnamedDefaultExport.baseline.jsonc New go-to-source-definition baseline.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource5_sameAsGoToDef1.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource6_sameAsGoToDef2.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource7_conditionallyMinified.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource8_mapFromAtTypes.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource9_mapFromAtTypes2.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource10_mapFromAtTypes3.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource1_localJsBesideDts.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource2_nodeModulesWithTypes.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource3_nodeModulesAtTypes.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource14_unresolvedRequireDestructuring.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource13_nodenext.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource12_callbackParam.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource15_bundler.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource16_callbackParamDifferentFile.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource17_AddsFileToProject.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource18_reusedFromDifferentFolder.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource11_propertyOfAlias.baseline.jsonc New/updated submodule baseline for go-to-source-definition.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource9_mapFromAtTypes2.baseline.jsonc.diff Updated diff baseline for submodule source-definition test.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource8_mapFromAtTypes.baseline.jsonc.diff Updated diff baseline for submodule source-definition test.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource7_conditionallyMinified.baseline.jsonc.diff Updated diff baseline for submodule source-definition test.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource6_sameAsGoToDef2.baseline.jsonc.diff Updated diff baseline for submodule source-definition test.
testdata/baselines/reference/submodule/fourslash/goToSourceDefinition/goToSource10_mapFromAtTypes3.baseline.jsonc.diff Updated diff baseline for submodule source-definition test.
testdata/baselines/reference/submodule/fourslash/goToDefinition/goToSource5_sameAsGoToDef1.baseline.jsonc Adds/updates baseline for go-to-definition in related submodule scenario.
testdata/baselines/reference/submodule/fourslash/goToDefinition/goToSource6_sameAsGoToDef2.baseline.jsonc Adds/updates baseline for go-to-definition in related submodule scenario.
_extension/src/languageFeatures/sourceDefinition.ts Adds VS Code command + request plumbing for source definition.
_extension/src/client.ts Registers the source-definition feature on client startup.
_extension/package.json Declares new command and contributes menus for editor/context + palette.

ctx context.Context,
node *ast.Node,
) ([]*ast.Node, string) {
c, done := r.program.GetTypeCheckerForFile(ctx, r.file)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using an existing checker on a file that may not be part of the program?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, r.file is only ever the original file from the request, so this should be safe. I waffled around a million times when working on this trying to figure out the best way to make that clear, though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using anything more than plain node/symbol information from the newly parsed file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it's all plain AST stuff. I'll see if I can keep moving things around so this doesn't look so suspect

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shifted things around to make it clear we can't touch any of it incorrectly.

Comment on lines +7 to +12
-// function lodash(value) {}
-// lodash.[|add|] = add;
-//
-// /** Detect free variable `global` from Node.js. */
-// var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
-// --- (line: 26) skipped ---
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing because we point to the function only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants