Skip to content

Commit

Permalink
Improve completion kinds
Browse files Browse the repository at this point in the history
Introduce these mappings:

label -> field
variant -> enum member

For items without precise kinds, we no longer select a related but
inaccurate kind.

Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Sep 19, 2021
1 parent b841d46 commit ac06aef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Unreleased

- More accurate completion kinds.
New completion kinds for variants and fields. Removed inaccurate completion
kinds for constructors and types. (#510)

# 1.8.2 (09/14/2021)

- Disable experimental dune support. It was accidentally left enabled.
Expand Down
13 changes: 6 additions & 7 deletions ocaml-lsp-server/src/compl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ end
let completion_kind kind : CompletionItemKind.t option =
match kind with
| `Value -> Some Value
| `Constructor -> Some Constructor
| `Variant -> None
| `Label -> Some Property
| `Module
| `Modtype ->
Some Module
| `Type -> Some TypeParameter
| `Variant -> Some EnumMember
| `Label -> Some Field
| `Module -> Some Module
| `Modtype -> Some Interface
| `MethodCall -> Some Method
| `Keyword -> Some Keyword
| `Constructor -> Some Constructor
| `Type -> Some TypeParameter

let prefix_of_position ~short_path source position =
match Msource.text source with
Expand Down

0 comments on commit ac06aef

Please sign in to comment.