cucumber / vscode

Official Visual Studio Code Extension for Cucumber
MIT License
65 stars 16 forks source link

Reindexing schedules on every "Go to Definition" #215

Open josemigallas opened 7 months ago

josemigallas commented 7 months ago

👓 What did you see?

Every time I "go to definition" of a step, a reindexing is scheduled which completely blocks VS code features, making it unusable.

✅ What did you expect to see?

Reindexing should happen when a step definition file changes, or on window reload or on demand. For larger projects I would prefer the indexation happening once when the editor starts and it can be reindexed manually with "Reload window".

📦 Which tool/library version are you using?

Visual Studio Code: 1.85.2
CucumberOpen.cucumber-official@1.8.1
stevejpurves.cucumber@0.14.0

🔬 How could we reproduce it?

Open output channel for "Cucumber Language Server" Right-click over a feature step and select "Go to Definition", alternatively click the step while pressing down cmd key.

cucumber

kieran-ryan commented 7 months ago

Thanks for the report @josemigallas!

Could you advise:

  1. In the attached gif, are you holding the command key and just hovering over the lines? Or also clicking?
  2. The reindexing is scheduled via the Language Server on file changes, are there any other extensions you are using or extensions that may be triggering file saves or formatting while carrying out this action?
    // The content of a text document has changed. This event is emitted
    // when the text document is first opened or when its content has changed.
    documents.onDidChangeContent(async (change) => {
      this.scheduleReindexing()
      if (change.document.uri.match(/\.feature$/)) {
        await this.sendDiagnostics(change.document)
      }
    })
josemigallas commented 7 months ago
  1. In the attached gif, are you holding the command key and just hovering over the lines? Or also clicking?

Holding the command key while hovering.

  1. The reindexing is scheduled via the Language Server on file changes, are there any other extensions you are using or extensions that may be triggering file saves or formatting while carrying out this action?

I don't think so but here's the list just in case:

bierner.emojisense
bierner.github-markdown-preview
bierner.markdown-checkbox
bierner.markdown-emoji
bierner.markdown-footnotes
bierner.markdown-mermaid
bierner.markdown-preview-github-styles
bierner.markdown-yaml-preamble
castwide.solargraph
codezombiech.gitignore
CucumberOpen.cucumber-official
dbaeumer.vscode-eslint
denoland.vscode-deno
donjayamanne.githistory
eamodio.gitlens
elia.erb-formatter
fabiospampinato.vscode-open-in-github
firsttris.vscode-jest-runner
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
hbenl.vscode-test-explorer
janisdd.vscode-edit-csv
kaiwood.endwise
LinusU.auto-dark-mode
LoranKloeze.ruby-rubocop-revived
ms-vscode.test-adapter-converter
ms-vsliveshare.vsliveshare
ms-vsliveshare.vsliveshare-pack
RobbOwen.synthwave-vscode
seatonjiang.gitmoji-vscode
shd101wyy.markdown-preview-enhanced
Shopify.ruby-lsp
sianglim.slim
sibiraj-s.vscode-scss-formatter
sissel.shopify-liquid
stevejpurves.cucumber
streetsidesoftware.code-spell-checker
stylelint.vscode-stylelint
SUPERTSY5.line-length-checker-vscode
Tyriar.lorem-ipsum
wix.vscode-import-cost
kieran-ryan commented 7 months ago

Thanks for detail @josemigallas - genuine bug!

Reason I could not initially reproduce, is once you click 'Go to Definition' and repeat the behaviour, it no longer continuously reindexes.

https://github.com/cucumber/vscode/assets/5904340/4652d4ee-902c-4dac-b880-582655d73924

We will at least need to reassess the event triggering the reindexing in the Cucumber Language Server to understand whether we can eliminate unnecessary reindexing calls. Feel free to take a look at the code as well in case you spot a fix - all inputs welcome.

Thanks again!

josemigallas commented 7 months ago

My pleasure!