-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow] Scoped libdef support 2/n: Filter out unavailable results for …
…IDE services Summary: In this diff, we will address the shortcoming from the previous diff, where we index every single globals, even if the scoped libdef config says that it won't be active for the current file. This diff addresses it in a simple way: we will post-process the auto-import results to filter these away, based on `Context.active_global_builtins.` Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D70532319 fbshipit-source-id: f213d61f70e97ec7e94bf8fce5177f5d54932655
- Loading branch information
1 parent
c721df6
commit 46881dd
Showing
16 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[libs] | ||
common_lib.js | ||
'<PROJECT_ROOT>/foo' -> 'foo_lib.js' | ||
'<PROJECT_ROOT>/bar' -> 'bar_lib.js' | ||
|
||
[options] | ||
all=true |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
shell: test.sh |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
common | ||
// ^ | ||
fooS | ||
// ^ | ||
barS | ||
// ^ |
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const commonValueWithOverride: boolean; | ||
declare const barSpecific: string; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const commonValueNoOverride: string; | ||
declare const commonValueWithOverride: string; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
common | ||
// ^ | ||
fooS | ||
// ^ | ||
barS | ||
// ^ |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
common | ||
// ^ | ||
fooS | ||
// ^ | ||
barS | ||
// ^ |
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const commonValueWithOverride: number; | ||
declare const fooSpecific: string; |
51 changes: 51 additions & 0 deletions
51
tests/libdef_scoped_autocomplete/libdef_scoped_autocomplete.exp
This file contains 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
common_test.js:1:7 | ||
Flags: --pretty --imports | ||
{ | ||
"result":[ | ||
{"name":"commonValueNoOverride","type":"(global)"}, | ||
{"name":"commonValueWithOverride","type":"(global)"} | ||
] | ||
} | ||
|
||
common_test.js:3:5 | ||
Flags: --pretty --imports | ||
{"result":[]} | ||
|
||
common_test.js:5:5 | ||
Flags: --pretty --imports | ||
{"result":[]} | ||
|
||
foo/test.js:1:7 | ||
Flags: --pretty --imports | ||
{ | ||
"result":[ | ||
{"name":"commonValueNoOverride","type":"(global)"}, | ||
{"name":"commonValueWithOverride","type":"(global)"} | ||
] | ||
} | ||
|
||
foo/test.js:3:5 | ||
Flags: --pretty --imports | ||
{"result":[{"name":"fooSpecific","type":"(global)"}]} | ||
|
||
foo/test.js:5:5 | ||
Flags: --pretty --imports | ||
{"result":[]} | ||
|
||
bar/test.js:1:7 | ||
Flags: --pretty --imports | ||
{ | ||
"result":[ | ||
{"name":"commonValueNoOverride","type":"(global)"}, | ||
{"name":"commonValueWithOverride","type":"(global)"} | ||
] | ||
} | ||
|
||
bar/test.js:3:5 | ||
Flags: --pretty --imports | ||
{"result":[]} | ||
|
||
bar/test.js:5:5 | ||
Flags: --pretty --imports | ||
{"result":[{"name":"barSpecific","type":"(global)"}]} | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# shellcheck disable=SC2094 | ||
|
||
queries_in_file autocomplete "common_test.js" --pretty --imports | ||
queries_in_file autocomplete "foo/test.js" --pretty --imports | ||
queries_in_file autocomplete "bar/test.js" --pretty --imports |