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

Treesitter support #145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Treesitter support #145

wants to merge 2 commits into from

Conversation

JafarAbdi
Copy link
Owner

@JafarAbdi JafarAbdi commented Dec 21, 2024

  • Make it possible to run ros_build from any directory
  • Add generate_python_stubs
  • Add treesitter support

Summary by Sourcery

Add Treesitter support for various languages, including Bash, C, C++, CMake, Dockerfile, Fish, HTML, XML, HTTP, JavaScript, JSON, Lua, Make, Markdown, Ninja, Protobuf, Python, Query, reStructuredText, Rust, TOML, TypeScript, Vim, Vimdoc, YAML, and Zig.

New Features:

  • Add support for Treesitter, enabling syntax highlighting and textobjects for a wide range of programming languages.

Tests:

  • Hide all semantic highlights.

Copy link
Contributor

sourcery-ai bot commented Dec 21, 2024

Reviewer's Guide by Sourcery

This pull request introduces treesitter support to the Neovim configuration, including setup, highlighting, incremental selection, textobjects, and language registration. It also makes several other improvements.

Class diagram for Treesitter configuration structure

classDiagram
    class TreesitterConfig {
        +ensure_installed: string[]
        +highlight: HighlightConfig
        +incremental_selection: SelectionConfig
        +textobjects: TextObjectsConfig
    }

    class HighlightConfig {
        +enable: boolean
        +disable(lang, buf): boolean
    }

    class SelectionConfig {
        +enable: boolean
        +keymaps: KeymapConfig
    }

    class TextObjectsConfig {
        +select: SelectConfig
        +swap: SwapConfig
        +move: MoveConfig
    }

    TreesitterConfig --> HighlightConfig
    TreesitterConfig --> SelectionConfig
    TreesitterConfig --> TextObjectsConfig
Loading

File-Level Changes

Change Details Files
Adds treesitter support for various languages
  • Installs treesitter and its dependencies.
  • Configures treesitter to support numerous languages including bash, c, c#, cmake, cpp, dockerfile, fish, html, xml, http, javascript, json, lua, make, markdown, ninja, proto, python, rst, rust, toml, typescript, vim, vimdoc, yaml, and zig.
  • Enables syntax highlighting for supported languages, with the option to disable it for specific languages or buffers.
  • Sets up incremental selection using the and keys.
  • Defines textobjects for functions, classes, parameters, conditionals, and loops, enabling selection and navigation within these code structures.
  • Configures textobject swapping and movement using leader keys and bracket shortcuts.
  • Registers treesitter support for xacro and urdf files as XML variants.
neovim/.config/nvim/init.lua
Adds custom treesitter highlight groups
  • Defines highlight groups for various treesitter captures, linking them to existing highlight groups or defining new ones.
  • Sets up default highlight groups for common code elements like punctuation, constants, strings, functions, keywords, and comments.
  • Overrides default LSP highlight groups for comments in C++ files.
neovim/.config/nvim/colors/onedark.lua
Adds generate_python_stubs script
  • Creates a new script named generate_python_stubs.
scripts/.local/bin/generate_python_stubs
Modifies ros_build script
  • Updates the ros_build script.
scripts/.local/bin/ros_build
Modifies myinstall script
  • Updates the myinstall script.
scripts/.local/bin/myinstall

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @JafarAbdi - I've reviewed your changes - here's some feedback:

Overall Comments:

  • PR description mentions changes to ros_build and adding generate_python_stubs, but these changes are either empty or missing in the diff. Please either remove these items from the description or include their implementations.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Successfully merging this pull request may close these issues.

1 participant