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

Incorrect hints when hover with using "plugin.lua" #388

Closed
serg3295 opened this issue Feb 8, 2021 · 1 comment
Closed

Incorrect hints when hover with using "plugin.lua" #388

serg3295 opened this issue Feb 8, 2021 · 1 comment

Comments

@serg3295
Copy link
Contributor

serg3295 commented Feb 8, 2021

Describe the bug
All hover hints for functions located above the function that is being replaced in "plugin. lua" always show information about the replaced function.
If any other function is located below the function that is being replaced in "plugin. lua", the hints are correct

Screenshots

luasrvErr4
luasrvErr5

Environment (please complete the following information):

  • OS: Windows
  • Is WSL remote? no
  • Client: VSCode

Additional context

-- plugin.lua
function OnSetText(uri, text)
  local diffs = {}

  local subst = {
    ['[%w_]+%s*%=%s*ucg%.()[%w_]+_hw_spi()']         = 'ucgDisplayType',
    ['[%w_]+%s*%=%s*u8g2%.()[%w]+_i2c_[%w_]+()']     = 'u8g2DisplayTypeI2C',
    ['[%w_]+%s*%=%s*u8g2%.()[%w]+_[^i][%w_]+()']     = 'u8g2DisplayTypeSPI',
    ['()require[%(%s\"\']+ftpserver[%)\"\']+()']     = 'FTP',
    ['()require[%(%s\"\']+liquidcrystal[%)\"\']+()'] = 'lc_meta',
    ['()require[%(%s\"\']+mcp23017[%)\"\']+()']      = 'mcp23017',
  }

  for patt, _ in pairs(subst) do
     for startPos, finishPos in text:gmatch(patt) do
	diffs[#diffs+1] = {
	  start  = startPos,
	  finish = finishPos - 1,
	  text   = ('%s'):format(subst[patt]),
	}
     end
  end

  return diffs
end
@sumneko sumneko closed this as completed in 831eb97 Feb 8, 2021
@serg3295
Copy link
Contributor Author

serg3295 commented Feb 8, 2021

I have checked it out, everything is working fine now. Thank you.

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

1 participant