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

Variables are never suggested if they start with a reserved word #36

Open
Brad-O opened this issue Oct 10, 2018 · 3 comments
Open

Variables are never suggested if they start with a reserved word #36

Brad-O opened this issue Oct 10, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@Brad-O
Copy link
Collaborator

Brad-O commented Oct 10, 2018

Subject of the issue

Variable names are not suggested if they start with a reserved word.

Your environment

  • your TSP shebang: none
  • version of tsplang extension: 0.4.2
  • version of visual studio code:
    Version: 1.28.0 (user setup)
    Commit: 431ef9da3cf88a7e164f9d33bf62695e07c6c2a9
    Date: 2018-10-05T14:58:53.203Z
    Electron: 2.0.9
    Chrome: 61.0.3163.100
    Node.js: 8.9.3
    V8: 6.1.534.41
    Architecture: x64

Steps to reproduce

Code example:
local repeat_id = display.create(settings_id, display.OBJ_EDIT_NUMBER, 200, 260, "Repeat Tolerance", "Repeat readings are ignored", display.NFORMAT_INTEGER, repeatThreshold*100, 1, 100, '%')
display.setevent(repea)

Expected behaviour

I would expect the reserved word to be suggested first, then any other variables that start with that name. OR I would expect the reserved word to be the only suggestion until I got to "repeat_", then I would expect the other variables to be suggested.

Actual behaviour

Only the reserved word is ever suggested.

@Brad-O
Copy link
Collaborator Author

Brad-O commented Oct 10, 2018

Update:

The listed Expected Behavior after OR is actually what happens currently, though it takes 2-3 extra characters after the reserved word for any suggestion to appear. Underscores are apparently not counted in those extra required characters either?

@ethall ethall added the enhancement New feature or request label Oct 10, 2018
@ethall
Copy link
Collaborator

ethall commented Oct 10, 2018

This also occurs when any completion item is suggested. Given the following example where completions are requested after smu:

local smu_stuff = 1
smu

The variable smu_stuff would not be suggested because the smu completion item would be in the list. However, narrowing the scope of the variable name to smu_stu would suggest smu_stuff because the extension has run out of possible suggestions.

When we run out of suggestions, then native VSCode suggestions take over and start populating found words. This native suggestion engine seems to have trouble with underscores. Consider the following example where completions are requested after smus:

local smustuff = 1
smus

In this case, VSCode is able to suggest smustuff.

@ethall
Copy link
Collaborator

ethall commented Oct 10, 2018

This will be fixed when a Lua parser is implemented, which may be awhile.

@ethall ethall added this to the v0.6.0 milestone Dec 31, 2018
@ethall ethall removed this from the v0.6.0 milestone May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants