Skip to content

Commit 939cce7

Browse files
lambdabaacommit-bot@chromium.org
authored andcommitted
Create analysis server flag --completion-model
This flag will take a path to a folder where completion language model files can be located. Omitting this flag will signal to analysis server that it should not use ML ranking for code completion, and the plan is for this capability to initially be opt-in / disabled by default. Change-Id: Ied18cd1e378c11607778fc116a7e0c3d72091e44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110401 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Ari Aye <[email protected]>
1 parent 9e4cf6a commit 939cce7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/analysis_server/lib/src/analysis_server.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,9 @@ class AnalysisServerOptions {
744744
/// Whether to use the Language Server Protocol.
745745
bool useLanguageServerProtocol = false;
746746

747+
/// Base path to locate trained completion language model files.
748+
String completionModelFolder;
749+
747750
/// Whether to enable parsing via the Fasta parser.
748751
bool useFastaParser = true;
749752

pkg/analysis_server/lib/src/server/driver.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ class Driver implements ServerStarter {
284284
*/
285285
static const String USE_LSP = "lsp";
286286

287+
/**
288+
* The path on disk to a directory containing language model files for smart
289+
* code completion.
290+
*/
291+
static const String COMPLETION_MODEL_FOLDER = "completion-model";
292+
287293
/**
288294
* The name of the flag to use summary2.
289295
*/
@@ -339,6 +345,8 @@ class Driver implements ServerStarter {
339345
analysisServerOptions.cacheFolder = results[CACHE_FOLDER];
340346
analysisServerOptions.useFastaParser = results[USE_FASTA_PARSER];
341347
analysisServerOptions.useLanguageServerProtocol = results[USE_LSP];
348+
analysisServerOptions.completionModelFolder =
349+
results[COMPLETION_MODEL_FOLDER];
342350
AnalysisDriver.useSummary2 = results[USE_SUMMARY2];
343351

344352
bool disableAnalyticsForSession = results[SUPPRESS_ANALYTICS_FLAG];
@@ -722,6 +730,8 @@ class Driver implements ServerStarter {
722730
help: "Whether to enable parsing via the Fasta parser");
723731
parser.addFlag(USE_LSP,
724732
defaultsTo: false, help: "Whether to use the Language Server Protocol");
733+
parser.addOption(COMPLETION_MODEL_FOLDER,
734+
help: "[path] path to the location of a code completion model");
725735
parser.addFlag(USE_SUMMARY2,
726736
defaultsTo: false, help: "Whether to use summary2");
727737
parser.addOption(TRAIN_USING,

0 commit comments

Comments
 (0)