Skip to content

Always show file tokens in JS completion lists #6850

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
merged 2 commits into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3823,7 +3823,7 @@ namespace ts {
return undefined;
}

const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData;
const { symbols, isMemberCompletion, isNewIdentifierLocation, location, isJsDocTagName } = completionData;

if (isJsDocTagName) {
// If the current position is a jsDoc tag name, only tag names should be provided for completion
Expand All @@ -3834,7 +3834,7 @@ namespace ts {

const entries: CompletionEntry[] = [];

if (isRightOfDot && isSourceFileJavaScript(sourceFile)) {
if (isSourceFileJavaScript(sourceFile)) {
const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries);
addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames));
}
Expand Down
15 changes: 15 additions & 0 deletions tests/cases/fourslash/getJavaScriptGlobalCompletions1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// <reference path="fourslash.ts" />

// @allowNonTsExtensions: true
// @Filename: Foo.js
//// function f() {
//// // helloWorld leaks from here into the global space?
//// if (helloWorld) {
//// return 3;
//// }
//// return 5;
//// }
////
//// hello/**/

verify.completionListContains('helloWorld');