helix icon indicating copy to clipboard operation
helix copied to clipboard

Multi-language documents don't benefit from navigation by tree-sitter

Open vv3rd opened this issue 2 years ago • 2 comments

Summary

In documents with multiple languages such as vue, svelte or html files, contents of <script> or <style> represented by a single node (most often raw_text).

Here's example of what I see when calling :tree-sitter-subtree command (I deleted <template> contents so that whole subtree is visible, but everything inside template seems to work as it should): Screenshot_20221106_202029

Similar story with template function invocations in javascript, in places where additional syntax highlighting is supported (to show that it's not just vue issue) Screenshot_20221106_203051

Reproduction Steps

I tried this:

  1. hx [any vue, svelte or html file]
  2. Start using unimpaired-style navigation or Syntax-tree Motions in script or style sections

I expected this to happen:

Navigation works just as in javascript/css files

Instead, this happened:

Unimpaired-style motions have no effect, A-left or A-right takes me to a sibling tag as opposed to a javascript textobject

Helix log

Probably nothing useful

~/.cache/helix/helix.log
2022-11-06T20:47:39.351 helix_term::application [ERROR] Language Server: Method not found client/registerCapability
2022-11-06T20:47:40.244 helix_lsp::transport [ERROR] err <- "DeprecationWarning: 'createIdentifier' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.\n"
2022-11-06T20:47:40.244 helix_lsp::transport [ERROR] err <- "DeprecationWarning: 'createImportClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.\n"
2022-11-06T20:47:40.244 helix_lsp::transport [ERROR] err <- "DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.\n"
2022-11-06T20:47:40.244 helix_lsp::transport [ERROR] err <- "DeprecationWarning: 'createImportDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.\n"
2022-11-06T20:47:40.245 helix_lsp::transport [ERROR] err <- "DeprecationWarning: 'createCallExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.\n"

Platform

Manjaro Linux

Terminal Emulator

Konsole, Kitty (probably irrelevant)

Helix Version

helix 22.08.1 (3881fef3)

vv3rd avatar Nov 06 '22 14:11 vv3rd

Duplicate-ish of https://github.com/helix-editor/helix/issues/2311

kirawi avatar Nov 06 '22 16:11 kirawi

True, seems to be the same issue. Is it on a roadmap? I probably can't do it myself.

vv3rd avatar Nov 06 '22 17:11 vv3rd

Closing in favor of https://github.com/helix-editor/helix/issues/9425

pascalkuthe avatar Apr 16 '24 03:04 pascalkuthe