mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 10:00:13 -06:00
remove external module from showing up on completion list
This commit is contained in:
parent
5a33707e38
commit
8f4ee917b2
@ -1687,7 +1687,7 @@ module ts {
|
||||
if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) &&
|
||||
(firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||
// If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
|
||||
// invalid identifer name. We need to check if whatever was inside the quotes is actually a valid identifier name.
|
||||
// invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.
|
||||
displayName = displayName.substring(1, displayName.length - 1);
|
||||
}
|
||||
|
||||
@ -1708,6 +1708,13 @@ module ts {
|
||||
// Try to get a valid display name for this symbol, if we could not find one, then ignore it.
|
||||
// We would like to only show things that can be added after a dot, so for instance numeric properties can
|
||||
// not be accessed with a dot (a.1 <- invalid)
|
||||
var firstCharCode = symbol.name.charCodeAt(0);
|
||||
if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||
// If the symbol is external module, don't retry the completion list
|
||||
// Also name of modules is invalid in completion list (i.e declare module "http" { var x; } | // <= request completion here, "http" should not be there)
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var displayName = getValidCompletionEntryDisplayName(symbol.getName(), program.getCompilerOptions().target);
|
||||
if (!displayName) {
|
||||
return undefined;
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
//// declare module "http" {
|
||||
//// var x;
|
||||
//// }
|
||||
//// /**/
|
||||
|
||||
goTo.marker();
|
||||
debugger
|
||||
verifyNegatable.completionListContains("http");
|
||||
@ -630,6 +630,7 @@ function verifyOperationIsCancelled(f) {
|
||||
var test = new FourSlashInterface.test_();
|
||||
var goTo = new FourSlashInterface.goTo();
|
||||
var verify = new FourSlashInterface.verify();
|
||||
var verifyNegatable = new FourSlashInterface.verifyNegatable(true);
|
||||
var edit = new FourSlashInterface.edit();
|
||||
var debug = new FourSlashInterface.debug();
|
||||
var format = new FourSlashInterface.format();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user