nimlsp icon indicating copy to clipboard operation
nimlsp copied to clipboard

Problems with tuple autocompletion

Open doongjohn opened this issue 3 years ago • 1 comments

there are two problems with tuple if the code is splitted into 2 modules

# module.nim

type B* = tuple
  a: int
  b: int

var x*: B = (a: 2, b: 10)
var y* = (a: 2, b: 10)
# main.nim

import module

echo x.a # problem1: tuple field a and b does not show up in the lsp autocompletion list
echo y.  # problem2: language server crashes when I type '.' after the letter 'y'

everything works fine if the code is not splited into 2 modules

# main.nim
# this works fine

type B* = tuple
  a: int
  b: int

var x*: B = (a: 2, b: 10)
var y* = (a: 2, b: 10)

echo x.a
echo y.b
# main.nim
# this also works fine

include module

echo x.a
echo y.b

nim version: 1.7.1 (devel) platform: Windows11 WSL2 (Void Linux) editor: neovim

doongjohn avatar Aug 08 '22 18:08 doongjohn

I believe this is a nimsuggest issue (nimlsp is simply using that as a library). Could you try to run the same tests with nimsuggest manually?

PMunch avatar Aug 08 '22 19:08 PMunch

I ran nimsuggest manually and it did the same thing

import module
echo x.

^ for this code nimsuggest does not suggest field a, b

import module
echo y.

^ for this code nimsuggest crashes with SIGSEGV: Illegal storage access.

doongjohn avatar Aug 13 '22 23:08 doongjohn

Then you should raise this issue in the nimsuggest issue tracker. There is unfortunately nothing that can be done to fix this in NimLSP. But feel free to link this issue so tht it's easier to track.

PMunch avatar Aug 14 '22 06:08 PMunch