Skip to content

Commit

Permalink
Create analysis server flag --completion-model
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lambdabaa authored and [email protected] committed Jul 24, 2019
1 parent 9e4cf6a commit 939cce7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/analysis_server/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,9 @@ class AnalysisServerOptions {
/// Whether to use the Language Server Protocol.
bool useLanguageServerProtocol = false;

/// Base path to locate trained completion language model files.
String completionModelFolder;

/// Whether to enable parsing via the Fasta parser.
bool useFastaParser = true;

Expand Down
10 changes: 10 additions & 0 deletions pkg/analysis_server/lib/src/server/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ class Driver implements ServerStarter {
*/
static const String USE_LSP = "lsp";

/**
* The path on disk to a directory containing language model files for smart
* code completion.
*/
static const String COMPLETION_MODEL_FOLDER = "completion-model";

/**
* The name of the flag to use summary2.
*/
Expand Down Expand Up @@ -339,6 +345,8 @@ class Driver implements ServerStarter {
analysisServerOptions.cacheFolder = results[CACHE_FOLDER];
analysisServerOptions.useFastaParser = results[USE_FASTA_PARSER];
analysisServerOptions.useLanguageServerProtocol = results[USE_LSP];
analysisServerOptions.completionModelFolder =
results[COMPLETION_MODEL_FOLDER];
AnalysisDriver.useSummary2 = results[USE_SUMMARY2];

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

0 comments on commit 939cce7

Please sign in to comment.