-
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] only populate search index if autoimports is true
Summary: `Export_search` results are only used to service auto-imports. When auto-imports are disabled (e.g. through setting `autoimports=false` in the flowconfig) we don't need to worry about indexing files. This diff makes `ServerEnv.exports` optional and only populates when the option is true. Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D69668537 ------------------------------------------------------------------------ (from 090ecacb3fea983e4ca4187aedab2bfcf92cff77) fbshipit-source-id: 5bcb35be85f055ebc4bb5941c4658836731b022a
- Loading branch information
1 parent
fc43315
commit 95569af
Showing
8 changed files
with
206 additions
and
31 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
newtests/lsp/completion/autoimports/__snapshots__/completion_with_no_autoimports.json
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,116 @@ | ||
{ | ||
"method": "textDocument/completion", | ||
"result": { | ||
"isIncomplete": false, | ||
"items": [ | ||
{ | ||
"label": "Test", | ||
"kind": 6, | ||
"detail": "type Test = any", | ||
"sortText": "00000000000000000000", | ||
"insertTextFormat": 1, | ||
"textEdit": { | ||
"range": { | ||
"start": { | ||
"line": 2, | ||
"character": 12 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 13 | ||
} | ||
}, | ||
"newText": "Test" | ||
}, | ||
"command": { | ||
"title": "", | ||
"command": "log:org.flow:<PLACEHOLDER_PROJECT_URL>", | ||
"arguments": [ | ||
"textDocument/completion", | ||
"unqualified type: local type identifier", | ||
{ | ||
"token": "TAUTO332", | ||
"index": 0, | ||
"session_requests": 1, | ||
"typed_length": 1, | ||
"completion": "Test", | ||
"ac_type": "Actype" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"label": "true", | ||
"kind": 6, | ||
"detail": "true", | ||
"sortText": "00000000000000000001", | ||
"insertTextFormat": 1, | ||
"textEdit": { | ||
"range": { | ||
"start": { | ||
"line": 2, | ||
"character": 12 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 13 | ||
} | ||
}, | ||
"newText": "true" | ||
}, | ||
"command": { | ||
"title": "", | ||
"command": "log:org.flow:<PLACEHOLDER_PROJECT_URL>", | ||
"arguments": [ | ||
"textDocument/completion", | ||
"builtin type", | ||
{ | ||
"token": "TAUTO332", | ||
"index": 1, | ||
"session_requests": 1, | ||
"typed_length": 1, | ||
"completion": "true", | ||
"ac_type": "Actype" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"label": "$NonMaybeType", | ||
"kind": 3, | ||
"detail": "$NonMaybeType", | ||
"sortText": "00000000000000000002", | ||
"insertTextFormat": 1, | ||
"textEdit": { | ||
"range": { | ||
"start": { | ||
"line": 2, | ||
"character": 12 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 13 | ||
} | ||
}, | ||
"newText": "$NonMaybeType" | ||
}, | ||
"command": { | ||
"title": "", | ||
"command": "log:org.flow:<PLACEHOLDER_PROJECT_URL>", | ||
"arguments": [ | ||
"textDocument/completion", | ||
"builtin type", | ||
{ | ||
"token": "TAUTO332", | ||
"index": 2, | ||
"session_requests": 1, | ||
"typed_length": 1, | ||
"completion": "$NonMaybeType", | ||
"ac_type": "Actype" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
newtests/lsp/completion/autoimports/_flowconfig_autoimports_false
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,9 @@ | ||
[libs] | ||
lib/ | ||
|
||
[options] | ||
exact_by_default=false | ||
autoimports=false | ||
|
||
; disabling the builtins prevents this test from failing every time they change | ||
no_flowlib=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
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