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

fix(lsp): handle negative activeSignature in signatureHelp #17064

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

mfussenegger
Copy link
Member

omnisharp-roslyn can send negative values:

{
  activeParameter = 0,
  activeSignature = -1,
  signatures = { {
      documentation = "",
      label = "TestEntity.TestEntity()",
      parameters = {}
    } }
}

In 3.16 of the specification activeSignature is defined as uinteger
and therefore negative values shouldn't be allowed, but within 3.15 it
was defined as number which makes me think we can be a bit lenient in
this case and handle them.

The expected behavior is quite clear:

The active signature. If omitted or the value lies outside the
range of `signatures` the value defaults to zero or is ignored if
the `SignatureHelp` has no signatures.

Fixes an error:

util.lua:1685: attempt to get length of local 'lines' (a nil value)
util.lua:1685: in function 'trim_empty_lines'
handlers.lua:334: in function 'textDocument/signatureHelp'

@github-actions github-actions bot added lsp lua stdlib labels Jan 12, 2022
@mjlbach
Copy link
Contributor

mjlbach commented Jan 12, 2022

Can you add a note in the line above this? Thanks!

@mfussenegger
Copy link
Member Author

Can you add a note in the line above this? Thanks!

Which line and what kind of note?

omnisharp-roslyn can send negative values:

    {
      activeParameter = 0,
      activeSignature = -1,
      signatures = { {
          documentation = "",
          label = "TestEntity.TestEntity()",
          parameters = {}
        } }
    }

In 3.16 of the specification `activeSignature` is defined as `uinteger`
and therefore negative values shouldn't be allowed, but within 3.15 it
was defined as `number` which makes me think we can be a bit lenient in
this case and handle them.

The expected behavior is quite clear:

    The active signature. If omitted or the value lies outside the
    range of `signatures` the value defaults to zero or is ignored if
    the `SignatureHelp` has no signatures.

Fixes an error:

    util.lua:1685: attempt to get length of local 'lines' (a nil value)
    util.lua:1685: in function 'trim_empty_lines'
    handlers.lua:334: in function 'textDocument/signatureHelp'
@mjlbach mjlbach merged commit e7cd811 into neovim:master Jan 13, 2022
zeertzjq pushed a commit to zeertzjq/neovim that referenced this pull request Jan 13, 2022
)

omnisharp-roslyn can send negative values:

    {
      activeParameter = 0,
      activeSignature = -1,
      signatures = { {
          documentation = "",
          label = "TestEntity.TestEntity()",
          parameters = {}
        } }
    }

In 3.16 of the specification `activeSignature` is defined as `uinteger`
and therefore negative values shouldn't be allowed, but within 3.15 it
was defined as `number` which makes me think we can be a bit lenient in
this case and handle them.

The expected behavior is quite clear:

    The active signature. If omitted or the value lies outside the
    range of `signatures` the value defaults to zero or is ignored if
    the `SignatureHelp` has no signatures.

Fixes an error:

    util.lua:1685: attempt to get length of local 'lines' (a nil value)
    util.lua:1685: in function 'trim_empty_lines'
    handlers.lua:334: in function 'textDocument/signatureHelp'
dmitmel pushed a commit to dmitmel/neovim that referenced this pull request Apr 16, 2022
)

omnisharp-roslyn can send negative values:

    {
      activeParameter = 0,
      activeSignature = -1,
      signatures = { {
          documentation = "",
          label = "TestEntity.TestEntity()",
          parameters = {}
        } }
    }

In 3.16 of the specification `activeSignature` is defined as `uinteger`
and therefore negative values shouldn't be allowed, but within 3.15 it
was defined as `number` which makes me think we can be a bit lenient in
this case and handle them.

The expected behavior is quite clear:

    The active signature. If omitted or the value lies outside the
    range of `signatures` the value defaults to zero or is ignored if
    the `SignatureHelp` has no signatures.

Fixes an error:

    util.lua:1685: attempt to get length of local 'lines' (a nil value)
    util.lua:1685: in function 'trim_empty_lines'
    handlers.lua:334: in function 'textDocument/signatureHelp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants