Skip to content

Incorrect symbol range from documentSymbol #2898

Open
@stevearc

Description

@stevearc

Your environment

Which OS do you use: Ubuntu, though this has also been seen on MacOS

Which LSP client (editor/plugin) do you use: Neovim builtin

Describe your project (alternative: link to the project): Repros in minimal project, detailed below

Steps to reproduce

  • cabal init to create a new project
  • Open the Main.hs file
  • Send a textDocument/documentSymbol request

Main.hs:

module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"

Expected behaviour

Data returned should match the file

Actual behaviour

{ {
    children = { {
        kind = 12,
        name = "main",
        range = {
          end = {
            character = 33,
            line = 3
          },
          start = {
            character = 0,
            line = 3
          }
        },
        selectionRange = {
          end = {
            character = 33,
            line = 3
          },
          start = {
            character = 0,
            line = 3
          }
        }
      } },
    kind = 1,
    name = "Main",
    range = {
      end = {
        character = 0,
        line = 2147483647
      },
      start = {
        character = 0,
        line = 0
      }
    },
    selectionRange = {
      end = {
        character = 11,
        line = 0
      },
      start = {
        character = 7,
        line = 0
      }
    }
  } }

The line = 2147483647 is the problem. It was causing issues with a plugin I wrote because I wasn't being defensive when processing the line numbers.
stevearc/aerial.nvim#101

Include debug information

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: ghcidelevel: easyThe issue is suited for beginnerstype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions