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 symbol positions from documentSymbol #2118

Closed
stevearc opened this issue Nov 16, 2022 · 0 comments
Closed

Incorrect symbol positions from documentSymbol #2118

stevearc opened this issue Nov 16, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@stevearc
Copy link

I'm seeing some incorrect values coming back from documentSymbol

Repro:

  • Create a new vue project with npm init vue@latest
  • Open the src/App.vue file and trim it down to be just the following (this is just to reduce the number of results and make it easier to read):
<template>
  <header>
    <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
  </header>
</template>
  • Open the file with any text editor that has a LSP client and issue a textDocument/documentSymbol request

This produces the following:

[
  {
    "containerName": "",
    "kind": 8,
    "location": {
      "range": {
        "end": {
          "character": 11,
          "line": 3
        },
        "start": {
          "character": 2,
          "line": 1
        }
      },
      "uri": "file:///home/stevearc/vue-project/src/App.vue"
    },
    "name": "header"
  },
  {
    "containerName": "header",
    "kind": 8,
    "location": {
      "range": {
        "end": {
          "character": 88,
          "line": 2
        },
        "start": {
          "character": 4,
          "line": 2
        }
      },
      "uri": "file:///home/stevearc/vue-project/src/App.vue"
    },
    "name": "img.logo"
  },
  {
    "kind": 2,
    "location": {
      "range": {
        "end": {
          "character": 0,
          "line": 4
        },
        "start": {
          "character": 10,
          "line": 0
        }
      },
      "uri": "file:///home/stevearc/vue-project/src/App.vue"
    },
    "name": "template"
  }
]

You can see that the "template" symbol claims to start on line 0 character 10. It should be starting on line 0 character 0. Character 10 is actually a position that does not exist in the file (<template> only has 10 characters, and character is 0-indexed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants