Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unqualified completions not working in NeoVim #408

Open
hesxenon opened this issue Feb 29, 2020 · 5 comments
Open

unqualified completions not working in NeoVim #408

hesxenon opened this issue Feb 29, 2020 · 5 comments

Comments

@hesxenon
Copy link

hesxenon commented Feb 29, 2020

using neovim with LanguageClient, and for some reason autocompleting Pervasives.int_of works but simply int_of does not work.

LanguageClient is triggering 'textDocument/completion' with characterposition

  • 0 for "int_of"
  • 11 for "Pervasives.int_of"

As far I've been able to tell a character offset of 0 would lead to PartialParser.findCompletable returning Nothing.

Shouldn't this complete modules and everything opened?

EDIT:
BuckleScript 7.1.1 ( Using OCaml:4.06.1+BS )

EDIT 2: log output that lead me to believe character 0 is the problem here

{"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":0,"line":7},"textDocument":{"uri":"file:///home/hesxenon/projects/powermaze/src/App.re"}},"id":10}
[server] Got a method textDocument/completion
[server] processing took 0.0109672546387ms
Nothing completable found :/
Sending response {"id": 10, "jsonrpc": "2.0", "result": []}

vs

{"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":5,"line":7},"textDocument":{"uri":"file:///home/hesxenon/projects/powermaze/src/App.re"}},"id":12}
[server] Got a method textDocument/completion
[server] processing took 0.00715255737305ms
Opens folkz > 0 
Package opens Pervasives Powermaze Powermaze
Package opens Pervasives Powermaze Powermaze
FINDING docs for module Impl(/home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.cmti, /home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli)
FINDING /home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.cmti src /home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli
FINDING docs for module Impl(/home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt, nil)
FINDING /home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt src 
FINDING docs for module Impl(/home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt, nil)
FINDING /home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt src 
Opens nows 3 file:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli file:///home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt file:///home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt
---------------- LOCAL VAL
 - Completing in file:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli
 -- not capitalized
 - Completing in file:///home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt
 -- not capitalized
 - Completing in file:///home/hesxenon/projects/powermaze/lib/bs/Powermaze.cmt
 -- not capitalized
Sending response {"id": 12, "jsonrpc": "2.0", "result": [{"label": "int_of_float", "kind": 12, "detail": "float => int", "documentation": "Truncate the given floating-point number to an integer. The result is unspecified if the argument is `nan` or falls outside the range of representable integers.\n\n\n\nfile:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli:612"}, {"label": "int_of_char", "kind": 12, "detail": "char => int", "documentation": "Return the ASCII code of the argument.\n\n\n\nfile:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli:683"}, {"label": "int_of_string_opt", "kind": 12, "detail": "string => option(int)", "documentation": "Same as `int_of_string`, but returns `None` instead of raising.\n\nSince: 4.05\n\nfile:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli:748"}, {"label": "int_of_string", "kind": 12, "detail": "string => int", "documentation": "Convert the given string to an integer. The string is read in decimal \\(by default, or if the string begins with `0u`\\), in hexadecimal \\(if it begins with `0x` or `0X`\\), in octal \\(if it begins with `0o` or `0O`\\), or in binary \\(if it begins with `0b` or `0B`\\).\n\nThe `0u` prefix reads the input as an unsigned integer in the range `[0, 2*max_int+1]`. If the input exceeds max_int it is converted to the signed integer `min_int + input - max_int - 1`.\n\nThe `_` \\(underscore\\) character can appear anywhere in the string and is ignored. Raise `Failure \"int_of_string\"` if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type `int`.\n\n\n\nfile:///home/hesxenon/projects/powermaze/node_modules/bs-platform/lib/ocaml/pervasives.mli:729"}]}
@jaredly
Copy link
Owner

jaredly commented Feb 29, 2020

What version of ocaml/bucklescript are you working with? This is what I see, with BS 7.0.1
image

@jaredly jaredly changed the title unqualified completions not working unqualified completions not working in NeoVim Feb 29, 2020
@hesxenon
Copy link
Author

using BuckleScript 7.1.1 ( Using OCaml:4.06.1+BS )

@hesxenon
Copy link
Author

using BS 7.0.1 did not change anything :/

@hesxenon
Copy link
Author

updated with log outputs, if you could confirm whether character: 0 in the position is the problem, I'd file a new issue with LanguageClient I guess, even though I wouldn't know why this should be different for reasonml (works for typescript with the same parameters as far as I can tell)

@hesxenon
Copy link
Author

hesxenon commented Mar 4, 2020

filed an issue with LanguageClient, seems to me like they're sending the wrong position for completion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants