Skip to content

Conversation

rgoomar
Copy link

@rgoomar rgoomar commented Sep 11, 2025

Overview

These changes made it so I could go to a proper definition. This approach aligns with the way the TypeScript version of the compiler does it using VFS only and VLQ decoding.

Basically we have a situation where we have an import in a .ts file like

import { getLogger } from '@latticehr/o11y';

in a directory like apps/app-one in an index.ts file and the @latticehr is an alias that should reference packages/o11y and it does go to the packages/o11y/dist/*.d.ts file although not the source file implementation

This gets to the correct file and line position using VLQ decoding like the TS version does.

This is an alternative approach to #1627 in a simpler way reusing existing functionality.

return fh.Content(), true
}
return "", false
return fs.source.FS().ReadFile(path)
Copy link
Author

Choose a reason for hiding this comment

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

This fixes issues with being able to get the source map files. It conforms to the fallback mechanism that TypeScript had which was going to the disk - https://github.com/microsoft/TypeScript/blob/release-5.9/src/services/sourcemaps.ts#L147-L151

"gotest.tools/v3/assert"
)

func TestInternalAliasGoToDefinition(t *testing.T) {
Copy link
Author

Choose a reason for hiding this comment

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

I specifically added this to have an automated test for functionality that wasn't tested by the baselines.

@rgoomar rgoomar requested a review from jakebailey September 11, 2025 20:36
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.

2 participants