-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add string literal completions for package.json
imports
field
#57718
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
Merged
andrewbranch
merged 27 commits into
microsoft:main
from
Andarist:pkg-json-imports-completions
Oct 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
238651d
Add string literal completions for `package.json` `imports` field
Andarist 2adb14c
format
Andarist 22b6148
Merge remote-tracking branch 'origin/main' into pkg-json-imports-comp…
Andarist 08eaa16
fixed server fixtures
Andarist 083c5b8
drop trailing slash support
Andarist b48f752
fix support for trailing slash
Andarist 07f6c3c
small tweaks
Andarist 117415a
fixed lint
Andarist db0d416
pass `moduleSpecifierResolutionHost` everywhere
Andarist 294c7da
`getMatchesWithPrefix` helper
Andarist 0d0b881
add more tests but break some of the existing ones
Andarist 475c0b1
fixed the incorrectly copy-pasted test
Andarist a0ea1b9
handle `inputDirectories`
Andarist c00448b
add more tests, some of them still failing
Andarist e96bd5a
add test with `allowImportingTsExtensions`
Andarist c36d20a
add extra tests with wildcard in the middle
Andarist 0f4a6f8
add pkg scope test
Andarist 6759383
remove broken path
Andarist 48b2c78
limit imports lookup
Andarist 56a1563
dedupe imports/exports lookup
Andarist b84468a
handle declarationDir separately
Andarist a80cdfa
use `ValidationFlags.AllowWildcard`
Andarist 96209a9
allowJs accepts a boolean, not String(boolea), doh
Andarist 17b2aae
split `importsLookup` out of `nodeModulesDirectoryOrImportsLookup` fo…
Andarist 22e4d49
Relax check for `inputExtension`
Andarist a18104e
swap `matchingSuffixes` to change the priority order for `trimPrefixA…
Andarist 36bed48
fmt
Andarist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -192,6 +192,7 @@ import { | |||||||||||||||||||||||||||
getParseTreeNode, | ||||||||||||||||||||||||||||
getPathComponents, | ||||||||||||||||||||||||||||
getPathFromPathComponents, | ||||||||||||||||||||||||||||
getRelativePathFromDirectory, | ||||||||||||||||||||||||||||
getRelativePathToDirectoryOrUrl, | ||||||||||||||||||||||||||||
getResolutionModeOverride, | ||||||||||||||||||||||||||||
getRootLength, | ||||||||||||||||||||||||||||
|
@@ -471,6 +472,7 @@ import { | |||||||||||||||||||||||||||
ResolvedModuleWithFailedLookupLocations, | ||||||||||||||||||||||||||||
ResolvedTypeReferenceDirective, | ||||||||||||||||||||||||||||
ResolvedTypeReferenceDirectiveWithFailedLookupLocations, | ||||||||||||||||||||||||||||
resolvePath, | ||||||||||||||||||||||||||||
ReturnStatement, | ||||||||||||||||||||||||||||
SatisfiesExpression, | ||||||||||||||||||||||||||||
ScriptKind, | ||||||||||||||||||||||||||||
|
@@ -6288,6 +6290,21 @@ export function getPossibleOriginalInputExtensionForExtension(path: string) { | |||||||||||||||||||||||||||
[Extension.Tsx, Extension.Ts, Extension.Jsx, Extension.Js]; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
/** @internal */ | ||||||||||||||||||||||||||||
export function getPossibleOriginalInputPathWithoutChangingExt( | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is kinda a reverse of TypeScript/src/compiler/emitter.ts Lines 542 to 554 in 3fca8c8
|
||||||||||||||||||||||||||||
filePath: string, | ||||||||||||||||||||||||||||
ignoreCase: boolean, | ||||||||||||||||||||||||||||
outputDir: string | undefined, | ||||||||||||||||||||||||||||
getCommonSourceDirectory: () => string, | ||||||||||||||||||||||||||||
): string { | ||||||||||||||||||||||||||||
return outputDir ? | ||||||||||||||||||||||||||||
resolvePath( | ||||||||||||||||||||||||||||
getCommonSourceDirectory(), | ||||||||||||||||||||||||||||
getRelativePathFromDirectory(outputDir, filePath, ignoreCase), | ||||||||||||||||||||||||||||
) : | ||||||||||||||||||||||||||||
filePath; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||
* Returns 'undefined' if and only if 'options.paths' is undefined. | ||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.