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

weird behaviour in typescript methods curly braces #374

Closed
alex-popov-tech opened this issue Nov 29, 2024 · 1 comment
Closed

weird behaviour in typescript methods curly braces #374

alex-popov-tech opened this issue Nov 29, 2024 · 1 comment
Labels

Comments

@alex-popov-tech
Copy link

Explain the issue

In typescript files, in methods, when you hover opening curly brace for method body it is not highlighting pair brace and not jumping between them with %. Whats weird, that if I hover closing curly brace, it highlights opening as pair and jumps to it with % ( one-way-ticket ).

NVIM v0.10.2 with treesitter

Steps:

  • hover opening bracket in provided code snippet, press %

AR: Nothing happens

ER: cursor should jump on closing curly brace for current method

Minimal working example

Please provide a minimal working example, e.g.,

import { Page } from '@playwright/test';

export class BasePage {
  constructor(
    public page: Page,
    public url = ''
  ) {}

  public async open({ path, query }: { path?: string | number; query?: string } = {}): Promise<void> {
    const url = () => {
      if (path && query) {
        return `${this.url}${path}?${query}`;
      } else if (path) {
        return `${this.url}${path}`;
      } else if (this.url && query) {
        return `${this.url}?${query}`;
      } else if (query) {
        throw new Error(`Unable to attach query "${query}" to empty URL: "${this.url}"`);
      } else {
        return this.url;
      }
    };
    await this.page.goto(url());
    await this.waitFor();
  }

  public async waitFor() {}
}

Minimal vimrc file

Im using lazy.nvim with default setup,

plugin

  {
    "andymass/vim-matchup",
    event = "VeryLazy",
    version = nil,
    branch = "master",
  }

treesitter

{
  "nvim-treesitter/nvim-treesitter",
  event = "VeryLazy",
  build = ":TSUpdate",
  config = function()
    require("nvim-treesitter.configs").setup({
      matchup = {
        enable = true, -- mandatory, false will disable the whole extension
      },
      ...
    })
    end,
  }
REC-20241130002551.mp4
@alex-popov-tech
Copy link
Author

@andymass thank you! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant