mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix(52233): Ambient modules declared with patterns are offered in path completions (#52246)
This commit is contained in:
parent
243d8de66d
commit
577cc1bd8a
@ -1025,7 +1025,7 @@ function removeLeadingDirectorySeparator(path: string): string {
|
||||
function getAmbientModuleCompletions(fragment: string, fragmentDirectory: string | undefined, checker: TypeChecker): readonly string[] {
|
||||
// Get modules that the type checker picked up
|
||||
const ambientModules = checker.getAmbientModules().map(sym => stripQuotes(sym.name));
|
||||
const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment));
|
||||
const nonRelativeModuleNames = ambientModules.filter(moduleName => startsWith(moduleName, fragment) && moduleName.indexOf("*") < 0);
|
||||
|
||||
// Nested modules of the form "module-name/sub" need to be adjusted to only return the string
|
||||
// after the last '/' that appears in the fragment because that's where the replacement span
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/a.ts",
|
||||
"position": 22,
|
||||
"name": ""
|
||||
},
|
||||
"completionList": {
|
||||
"isGlobalCompletion": false,
|
||||
"isMemberCompletion": false,
|
||||
"isNewIdentifierLocation": true,
|
||||
"entries": []
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,9 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @filename: /globals.d.ts
|
||||
////declare module "*.css";
|
||||
|
||||
// @filename: /a.ts
|
||||
////import * as foo from "/**/";
|
||||
|
||||
verify.baselineCompletions();
|
||||
Loading…
x
Reference in New Issue
Block a user