Skip to content

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

Open

Description

@sean-garwood

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 LSP Rails

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
{}
User
{
  "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)

Activity

  1. added
    bugSomething isn't working
    vscodeThis pull request should be included in the VS Code extension's release notes
    on Oct 25, 2024
  2. vinistock commented on Oct 28, 2024

    @vinistock
    Member

    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?

  3. sean-garwood commented on Oct 28, 2024

    @sean-garwood
    Author

    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:

    • disabled the two other ruby-related extensions that were enabled while testing:
      • dark-ruby-theme (1.2.0)
      • vscode-erb-beautify (0.5.0)
    • restarted VSCode

    The issue persists.

  4. andyw8 commented on Oct 28, 2024

    @andyw8
    Contributor

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

  5. andyw8 commented on Oct 28, 2024

    @andyw8
    Contributor

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

  6. andyw8 commented on Oct 28, 2024

    @andyw8
    Contributor

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

  7. mahmoudimus commented on Dec 9, 2024

    @mahmoudimus

    Hi, do we have any update on this issue?

  8. added
    help-wantedExtra attention is needed
    pinnedThis issue or pull request is pinned and won't be marked as stale
    on Jan 7, 2025
  9. brunoprietog commented on May 23, 2025

    @brunoprietog

    Do you have any updates on this? Please 🙏

  10. rafayqayyum commented on Nov 8, 2026

    @rafayqayyum

    I think I found the cause: documents are parsed when they're opened, so the delegate/textDocument/virtualState notification is only sent after the first edit. A freshly opened ERB file has no embedded content for the extension to resolve until you type something, which would explain why it only reproduces for some people. Opened #4267 to send the virtual state on didOpen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp-wantedExtra attention is neededpinnedThis issue or pull request is pinned and won't be marked as stalevscodeThis pull request should be included in the VS Code extension's release notes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions