Code Monkey home page Code Monkey logo

ttags's Introduction

ttags

ttags generates ctags using Tree-sitter.

Installation

macOS and Linux
cargo install ttags

Binaries are also available on the releases page of the repo. Download the tar file, and place the executable in your path.

From source
git clone https://github.com/npezza93/ttags
cd ttags
cargo build --release
./target/release/ttags $(git ls-files)

Usage

Give a list of file paths and/or directories to ttags to parse and generate.

ttags $(git ls-files)

Options

  • -a or --apend - Will keep your tag file in tact and only update the tags for the files passed.

  • -r or --tag-relative - Make paths outputed in the tags file be relative to the current working directory (i.e. where you called ttags)? By default, the tag path is relative to the tag-file location.

  • -f or --tag-file=file - Path to the file where tags should be written. If - is passed, tags are outputted to stdout.

  • lsp - Starts an LSP server that updates the tags for a file when the file is saved

Supported languages

  • Haskell
  • JavaScript
  • Nix
  • Ruby
  • Rust
  • Swift

ttags's People

Contributors

mrcjkb avatar npezza93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ttags's Issues

Use tree-sitter's offical query

Currently, the query is maintained in this repo, however, most tree-sitter's language adapter provides the corrsponding tags query grammar, like tree_sitter_rust::TAGS_QUERY. So i'm a bit confused about the reason of not using the official tags query.

Unable to install ttags v0.3.0 via cargo

Hey I'm unable to install ttags via cargo. It looks like there is an issue with ttags and npezza93_tree-sitter-tags v0.21.0

Could you pls help with this?

% cargo install ttags

Updating crates.io index

Downloaded ttags v0.3.0
Downloaded 1 crate (15.4 KB) in 1.10s
Installing ttags v0.3.0
Updating crates.io index
Fetch [===========> ] 9 complete; 9 pending Fetch [==============> ] 32 complete; 8 pending Downloading 1 crate Downloading 2 crates Downloading 3 crates Downloading 4 crates Downloading 5 crates Downloading 6 crates Downloading 7 crates Downloading 8 crates Downloading 9 crates Downloading 10 crates Downloading 11 crates Downloading 12 crates Downloading 13 crates Downloading 14 crates Downloading 15 crates Downloading 16 crates Downloading 17 crates Downloading 18 crates Downloading 19 crates Downloading 20 crates Downloading 21 crates Fetch [=============================> ] 66 complete; 1 pending Downloading 22 crates
Downloaded Inflector v0.11.4
Downloading 21 crates, remaining bytes: 221.9 KB
Downloaded lsp-types v0.94.1
Downloaded vec_map v0.8.2
Downloaded serde_repr v0.1.19
Downloaded textwrap v0.11.0
Downloaded strsim v0.8.0
Downloaded lsp-server v0.7.6
Downloaded proc-macro2 v1.0.81
Downloaded serde_derive v1.0.198
Downloaded serde v1.0.198
Downloaded crossbeam-channel v0.5.12
Downloaded serde_json v1.0.116
Downloaded syn v2.0.60
Downloaded rayon v1.10.0
Downloaded clap v2.34.0
Downloaded sugar_path v0.0.9
Downloaded npezza93_tree-sitter-tags v0.21.0
Downloaded tree-sitter-nix v0.0.1
Downloaded tree-sitter-javascript v0.21.0
Downloaded tree-sitter-rust v0.21.0
Downloaded tree-sitter-swift v0.3.6
Downloaded npezza93-tree-sitter-haskell v0.14.1
Downloaded 22 crates (3.6 MB) in 2.60s (largest was npezza93-tree-sitter-haskell at 1.1 MB)
Compiling cc v1.0.94
Compiling proc-macro2 v1.0.81
Compiling unicode-ident v1.0.12
Compiling memchr v2.7.2
Compiling regex-syntax v0.8.3
Compiling libc v0.2.153
Compiling crossbeam-utils v0.8.19
Compiling serde v1.0.198
Compiling tinyvec_macros v0.1.1
Compiling unicode-width v0.1.11
Compiling tinyvec v1.6.0
Compiling serde_json v1.0.116
Compiling textwrap v0.11.0
Compiling strsim v0.8.0
Compiling aho-corasick v1.1.3
Compiling unicode-normalization v0.1.23
Compiling vec_map v0.8.2
Compiling tree-sitter v0.22.5
Compiling regex-automata v0.4.6
Compiling tree-sitter v0.20.10
Compiling quote v1.0.36
Compiling syn v2.0.60
Compiling thiserror v1.0.58
Compiling regex v1.10.4
Compiling crossbeam-epoch v0.9.18
Compiling atty v0.2.14
Compiling unicode-bidi v0.3.15
Compiling bitflags v1.3.2
Compiling ansi_term v0.12.1
Compiling percent-encoding v2.3.1
Compiling rayon-core v1.12.1
Compiling itoa v1.0.11
Compiling ryu v1.0.17
Compiling form_urlencoded v1.2.1
Compiling idna v0.5.0
Compiling clap v2.34.0
Compiling crossbeam-deque v0.8.5
Compiling serde_derive v1.0.198
Compiling thiserror-impl v1.0.58
Compiling tree-sitter-nix v0.0.1
Compiling tree-sitter-ruby v0.20.1
Compiling tree-sitter-javascript v0.21.0
Compiling tree-sitter-rust v0.21.0
Compiling npezza93-tree-sitter-haskell v0.14.1
Compiling tree-sitter-swift v0.3.6
Compiling ttags v0.3.0
Compiling serde_repr v0.1.19
Compiling crossbeam-channel v0.5.12
Compiling lazy_static v1.4.0
Compiling once_cell v1.19.0
Compiling either v1.11.0
Compiling same-file v1.0.6
Compiling log v0.4.21
Compiling walkdir v2.5.0
Compiling url v2.5.0
Compiling lsp-types v0.94.1
Compiling lsp-server v0.7.6
Compiling rayon v1.10.0
Compiling sugar_path v0.0.9
Compiling Inflector v0.11.4
Compiling pathdiff v0.2.1
Compiling npezza93_tree-sitter-tags v0.21.0
error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/haskell.rs:9:9
|
8 | TagsConfiguration::new(
| ---------------------- arguments to this function are incorrect
9 | npezza93_tree_sitter_haskell::language(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tree_sitter::Language, found a different tree_sitter::Language
|
= note: tree_sitter::Language and tree_sitter::Language have similar names, but are actually distinct types
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
|
43 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:54:1
|
54 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate tree_sitter are being used?
note: associated function defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/npezza93_tree-sitter-tags-0.21.0/src/lib.rs:121:12
|
121 | pub fn new(language: Language, tags_query: &str, locals_query: &str) -> Result<Self, Error> {
| ^^^

error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/nix.rs:9:9
|
8 | TagsConfiguration::new(
| ---------------------- arguments to this function are incorrect
9 | tree_sitter_nix::language(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tree_sitter::Language, found a different tree_sitter::Language
|
= note: tree_sitter::Language and tree_sitter::Language have similar names, but are actually distinct types
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
|
43 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:54:1
|
54 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate tree_sitter are being used?
note: associated function defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/npezza93_tree-sitter-tags-0.21.0/src/lib.rs:121:12
|
121 | pub fn new(language: Language, tags_query: &str, locals_query: &str) -> Result<Self, Error> {
| ^^^

error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/ruby.rs:12:9
|
11 | TagsConfiguration::new(
| ---------------------- arguments to this function are incorrect
12 | tree_sitter_ruby::language(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tree_sitter::Language, found a different tree_sitter::Language
|
= note: tree_sitter::Language and tree_sitter::Language have similar names, but are actually distinct types
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
|
43 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:54:1
|
54 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate tree_sitter are being used?
note: associated function defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/npezza93_tree-sitter-tags-0.21.0/src/lib.rs:121:12
|
121 | pub fn new(language: Language, tags_query: &str, locals_query: &str) -> Result<Self, Error> {
| ^^^

error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/ruby.rs:141:25
|
141 | parser.set_language(tree_sitter_ruby::language()).unwrap();
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &Language, found Language
| |
| arguments to this method are incorrect
|
note: method defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:457:12
|
457 | pub fn set_language(&mut self, language: &Language) -> Result<(), LanguageError> {
| ^^^^^^^^^^^^

error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/ruby.rs:145:28
|
145 | let query = Query::new(tree_sitter_ruby::language(), DELEGATE_SCHEMA).unwrap();
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &Language, found Language
| |
| arguments to this function are incorrect
|
note: associated function defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:1749:12
|
1749 | pub fn new(language: &Language, source: &str) -> Result<Self, QueryError> {
| ^^^

error[E0308]: mismatched types
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ttags-0.3.0/src/swift.rs:9:9
|
8 | TagsConfiguration::new(
| ---------------------- arguments to this function are incorrect
9 | tree_sitter_swift::language(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tree_sitter::Language, found a different tree_sitter::Language
|
= note: tree_sitter::Language and tree_sitter::Language have similar names, but are actually distinct types
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
|
43 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
note: tree_sitter::Language is defined in crate tree_sitter
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.5/binding_rust/lib.rs:54:1
|
54 | pub struct Language(*const ffi::TSLanguage);
| ^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate tree_sitter are being used?
note: associated function defined here
--> /Users/bsunder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/npezza93_tree-sitter-tags-0.21.0/src/lib.rs:121:12
|
121 | pub fn new(language: Language, tags_query: &str, locals_query: &str) -> Result<Self, Error> {
| ^^^

For more information about this error, try rustc --explain E0308.
error: could not compile ttags (lib) due to 6 previous errors
error: failed to compile ttags v0.3.0, intermediate artifacts can be found at /var/folders/nh/vdgbq5yn4wqbc5cmfspqc9hh0000gp/T/cargo-installSYOIgc.
To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

Support relative option

When passed relative the file paths in the tag file with be relative to the path of the tags file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.