Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.61k stars 166 forks source link

`Error: Unable to resolve text model content for resource embedded` when hovering HTML #2784

Open sean-garwood opened 4 weeks ago

sean-garwood commented 4 weeks ago

Description

Ruby LSP Information

VS Code Version

1.94.2

Ruby LSP Extension Version

0.8.8

Ruby LSP Server Version

0.20.1

Ruby LSP Addons

Ruby Version

3.3.5

Ruby Version Manager

rbenv

Installed Extensions

Click to expand - vscode-erb-beautify (0.5.0) - vscode-django (1.15.0) - vscode-markdownlint (0.56.0) - python-environment-manager (1.2.4) - python-extension-pack (1.7.0) - EditorConfig (0.16.4) - copilot (1.242.1180) - copilot-chat (0.22.2024100702) - vscode-github-actions (0.27.0) - go (0.42.1) - haskell (2.4.4) - language-haskell (3.6.0) - vsc-python-indent (1.18.0) - rainbow-csv (3.12.0) - git-graph (1.30.0) - data-workspace-vscode (0.5.0) - mssql (1.25.0) - sql-bindings-vscode (0.4.0) - sql-database-projects-vscode (1.4.3) - debugpy (2024.12.0) - isort (2023.10.1) - pylint (2024.0.0) - python (2024.16.1) - vscode-pylance (2024.10.1) - datawrangler (1.12.0) - jupyter (2024.9.1) - jupyter-keymap (1.1.2) - jupyter-renderers (1.0.19) - cmake-tools (1.19.52) - cpptools (1.22.10) - cpptools-extension-pack (1.3.0) - cpptools-themes (2.0.0) - hexeditor (1.10.0) - makefile-tools (0.11.13) - powershell (2024.2.2) - vscode-speech (0.10.0) - autodocstring (0.6.1) - vscode-powerquery (0.1.60) - scala (0.5.8) - metals (1.40.0) - ruby-lsp (0.8.8) - rewrap (1.16.3) - cmake (0.0.17) - vim (1.28.1) - jinja (0.0.8) - five-server (0.3.1) - dark-ruby-theme (1.2.0) - markdown-pdf (1.5.0)

Ruby LSP Settings

Click to expand ##### Workspace ```json {} ``` ##### User ```json { "enableExperimentalFeatures": true, "enabledFeatures": { "codeActions": true, "diagnostics": true, "documentHighlights": true, "documentLink": true, "documentSymbols": true, "foldingRanges": true, "formatting": true, "hover": true, "inlayHint": true, "onTypeFormatting": true, "selectionRanges": true, "semanticHighlighting": true, "completion": true, "codeLens": true, "definition": true, "workspaceSymbol": true, "signatureHelp": true, "typeHierarchy": true }, "featuresConfiguration": {}, "addonSettings": { "rubocop": { "lint": true, "format": true }, "erb": { "lint": true, "format": true } }, "rubyVersionManager": { "identifier": "auto" }, "customRubyCommand": "", "formatter": "rubocop", "linters": null, "bundleGemfile": "", "testTimeout": 30, "branch": "", "pullDiagnosticsOn": "both", "useBundlerCompose": false, "bypassTypechecker": false, "rubyExecutablePath": "", "indexing": {}, "erbSupport": true } ```

Reproduction steps

  1. Start the Ruby LSP using VSCode
  2. Open an ERB file
  3. Hover over an HTML tag
  4. No documentation provided and error thrown. The Ruby LSP output is as follows:
2024-10-25 15:21:20.805 [info] (top_flickr_api) [Error - 3:21:20 PM] Request textDocument/hover failed.
2024-10-25 15:21:20.805 [info] (top_flickr_api) Error: Unable to resolve text model content for resource embedded-content://html/file%3A///home/username/courses/top/rails/top_flickr_api/app/views/layouts/application.html.erb.html
    at q8e.u (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1279:21909)
    at async q8e.r (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1279:20939)
    at async nfi.acquire (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:25:3125)
    at async G8e.createModelReference (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1279:22405)
vinistock commented 3 weeks ago

Thank you for the bug report! I can't seem to reproduce it by following the steps. Maybe it could be related to the structure of the ERB file or potentially some other extension you have installed.

Do you see this error on every ERB document? And for every HTML element?

sean-garwood commented 3 weeks ago

Thank you for the bug report! I can't seem to reproduce it by following the steps. Maybe it could be related to the structure of the ERB file or potentially some other extension you have installed.

Do you see this error on every ERB document? And for every HTML element?

Yes, this triggers on hover for every HTML element in every ERB file I've tested, even app defaults (as in, built when bin/rails new some_app is invoked in bash in project's parent directory) such as application.html.erb and mailer.html.erb.

I noticed that the error output is looking for embedded-content://.../mailer.html.erb.html:

Error: Unable to resolve text model content for resource embedded-content://html/file%3A///home/ssg/courses/top/rails/top_flickr_api/app/views/layouts/mailer.html.erb.html

Not sure if this is intended behavior or something else.

Another user got this same behavior when cloning two repositories I used to test this:

  1. top_flight_booker
  2. top_flickr_api

I also:

The issue persists.

andyw8 commented 3 weeks ago

Thank you, I was able to reproduce this error on top_flickr_api. We will investigate.

andyw8 commented 3 weeks ago

Can also reproduce on other repos, e.g. ruby-lsp-rails.

andyw8 commented 3 weeks ago

Verified that this also happens in the previous VS Code release (1.93.1).