mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Don't provide spelling suggestion for module (#22805)
This commit is contained in:
parent
810b386c2a
commit
94570eedcc
@ -16373,7 +16373,8 @@ namespace ts {
|
||||
const nameLowerCase = name.toLowerCase();
|
||||
for (const candidate of symbols) {
|
||||
const candidateName = symbolName(candidate);
|
||||
if (!(candidate.flags & meaning && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference)) {
|
||||
if (candidateName.charCodeAt(0) === CharacterCodes.doubleQuote
|
||||
|| !(candidate.flags & meaning && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference)) {
|
||||
continue;
|
||||
}
|
||||
const candidateNameLowerCase = candidateName.toLowerCase();
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/spellingSuggestionModule.ts(2,1): error TS2304: Cannot find name 'foobar'.
|
||||
tests/cases/compiler/spellingSuggestionModule.ts(5,1): error TS2304: Cannot find name 'barfoo'.
|
||||
tests/cases/compiler/spellingSuggestionModule.ts(8,1): error TS2552: Cannot find name 'faroo'. Did you mean 'farboo'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/spellingSuggestionModule.ts (3 errors) ====
|
||||
declare module "foobar" { export const x: number; }
|
||||
foobar;
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'foobar'.
|
||||
|
||||
declare module 'barfoo' { export const x: number; }
|
||||
barfoo;
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'barfoo'.
|
||||
|
||||
declare module farboo { export const x: number; }
|
||||
faroo;
|
||||
~~~~~
|
||||
!!! error TS2552: Cannot find name 'faroo'. Did you mean 'farboo'?
|
||||
|
||||
15
tests/baselines/reference/spellingSuggestionModule.js
Normal file
15
tests/baselines/reference/spellingSuggestionModule.js
Normal file
@ -0,0 +1,15 @@
|
||||
//// [spellingSuggestionModule.ts]
|
||||
declare module "foobar" { export const x: number; }
|
||||
foobar;
|
||||
|
||||
declare module 'barfoo' { export const x: number; }
|
||||
barfoo;
|
||||
|
||||
declare module farboo { export const x: number; }
|
||||
faroo;
|
||||
|
||||
|
||||
//// [spellingSuggestionModule.js]
|
||||
foobar;
|
||||
barfoo;
|
||||
faroo;
|
||||
19
tests/baselines/reference/spellingSuggestionModule.symbols
Normal file
19
tests/baselines/reference/spellingSuggestionModule.symbols
Normal file
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/spellingSuggestionModule.ts ===
|
||||
declare module "foobar" { export const x: number; }
|
||||
>"foobar" : Symbol("foobar", Decl(spellingSuggestionModule.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(spellingSuggestionModule.ts, 0, 38))
|
||||
|
||||
foobar;
|
||||
|
||||
declare module 'barfoo' { export const x: number; }
|
||||
>'barfoo' : Symbol('barfoo', Decl(spellingSuggestionModule.ts, 1, 7))
|
||||
>x : Symbol(x, Decl(spellingSuggestionModule.ts, 3, 38))
|
||||
|
||||
barfoo;
|
||||
|
||||
declare module farboo { export const x: number; }
|
||||
>farboo : Symbol(farboo, Decl(spellingSuggestionModule.ts, 4, 7))
|
||||
>x : Symbol(x, Decl(spellingSuggestionModule.ts, 6, 36))
|
||||
|
||||
faroo;
|
||||
|
||||
22
tests/baselines/reference/spellingSuggestionModule.types
Normal file
22
tests/baselines/reference/spellingSuggestionModule.types
Normal file
@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/spellingSuggestionModule.ts ===
|
||||
declare module "foobar" { export const x: number; }
|
||||
>"foobar" : typeof "foobar"
|
||||
>x : number
|
||||
|
||||
foobar;
|
||||
>foobar : any
|
||||
|
||||
declare module 'barfoo' { export const x: number; }
|
||||
>'barfoo' : typeof 'barfoo'
|
||||
>x : number
|
||||
|
||||
barfoo;
|
||||
>barfoo : any
|
||||
|
||||
declare module farboo { export const x: number; }
|
||||
>farboo : typeof farboo
|
||||
>x : number
|
||||
|
||||
faroo;
|
||||
>faroo : any
|
||||
|
||||
8
tests/cases/compiler/spellingSuggestionModule.ts
Normal file
8
tests/cases/compiler/spellingSuggestionModule.ts
Normal file
@ -0,0 +1,8 @@
|
||||
declare module "foobar" { export const x: number; }
|
||||
foobar;
|
||||
|
||||
declare module 'barfoo' { export const x: number; }
|
||||
barfoo;
|
||||
|
||||
declare module farboo { export const x: number; }
|
||||
faroo;
|
||||
Loading…
x
Reference in New Issue
Block a user