-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into setup-ocaml-action
- Loading branch information
Showing
91 changed files
with
12,629 additions
and
9,722 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
/* Bit of a hack. We want to decorate suggestions which will trigger | ||
an expansion to telegraph that expansion. Easiest way metrics wise | ||
is to keep that deco in the syntax. Want to decorate with ellipses | ||
character, but OCaml string functions don't support unicode, so | ||
we use $, then swap it out for the unicode character in Code. | ||
Eventually replace this by extending the suggestion data structure */ | ||
let c = "$"; | ||
/* We decorate buffers whose content will result in an | ||
* expansion with a trailing "...". Note that this ... | ||
* (at least in the current implementation) is not literally | ||
* inserted into the syntax so will not be reflected | ||
* in the decoration metrics */ | ||
|
||
let is_expander_tok = (t: Token.t) => | ||
String.sub(t, String.length(t) - 1, 1) == c; | ||
|
||
let trim_last = (t: Token.t) => String.sub(t, 0, String.length(t) - 1); | ||
let last = t => String.sub(t, String.length(t) - 1, 1); | ||
|
||
let is_expander = (label: Label.t) => | ||
switch (label) { | ||
| [t] => is_expander_tok(t) | ||
| [t] => last(t) == " " || last(t) == "(" | ||
| _ => false | ||
}; | ||
|
||
let mark = (label: Label.t): Label.t => | ||
is_expander(label) ? List.map(t => trim_last(t) ++ "…", label) : label; | ||
|
||
let trim = (completion: Token.t): Token.t => | ||
is_expander_tok(completion) ? trim_last(completion) : completion; | ||
is_expander(label) ? List.map(t => t ++ "…", label) : label; |
Oops, something went wrong.