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

JS's generator function not recognized #633

Closed
JonatasAmaral opened this issue Jun 14, 2024 · 0 comments · Fixed by #689
Closed

JS's generator function not recognized #633

JonatasAmaral opened this issue Jun 14, 2024 · 0 comments · Fixed by #689
Labels
bug Something isn't working

Comments

@JonatasAmaral
Copy link

JonatasAmaral commented Jun 14, 2024

Describe the bug

TS doesn't select nothing when trying a function selection (:TSTextobjectSelect @function.[outer|inner] ), in a JS generator function, which has a * after the function keyword.

function f() {

// generator
function* f() {

To Reproduce

  1. Open a new file, in a neovim instance with TS installed
  2. Write/paste a generator function
    function* f() {
      for (let i = 0; i < 10; i++) {
        yield i;
      }
    }
  3. Put cursor inside and try select the whole function body with :TSTextobjectSelect @function.inner

Expected behavior

To have a selection from whats inside function's brackets.
image

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v20.12.2 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.5.0-35-generic",
  sysname = "Linux",
  version = "#35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - diff                ✓ . . . .
  - dockerfile          ✓ . . . ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - gomod               ✓ . . . ✓
  - gosum               ✓ . . . .
  - gowork              ✓ . . . ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - jsdoc               ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - json5               ✓ . . . ✓
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luadoc              ✓ . . . .
  - luap                ✓ . . . .
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - ninja               ✓ . ✓ ✓ .
  - nix                 ✓ ✓ ✓ . ✓
  - php                 ✓ ✓ ✓ ✓ ✓
  - printf              ✓ . . . .
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - regex               ✓ . . . .
  - rst                 ✓ ✓ . . ✓
  - sql                 ✓ . . ✓ ✓
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - xml                 ✓ ✓ ✓ ✓ ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

Output of nvim --version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1693350652

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/p6yjk786ghbywcv3mjya7a64xrp5lzf2-neovim-unwrapped-0.9.5/share/nvim
"

Run :checkhealth for more info

Additional context

It does work in other generators form, Object property, Class Method, and Computed prod

But does not for any for of function

function* f() { // no

const f = function* () { // nop

// this one neither
function *f() { // no
@JonatasAmaral JonatasAmaral added the bug Something isn't working label Jun 14, 2024
@clason clason transferred this issue from nvim-treesitter/nvim-treesitter Jun 14, 2024
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

Successfully merging a pull request may close this issue.

1 participant