universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.58k stars 629 forks source link

Clojure improvements #4123

Open aartaka opened 5 days ago

aartaka commented 5 days ago

The name of the parser: clojure

Ctags only supports functions and namespaces in Clojure, lacking e.g. types and variables.

Find the examples of def and defonce for variables; defmacro for macros; defmulti for multimethods and defmethod for methods; deftype and defrecord for types; defprotocol and definterface for Clojure and Java interfaces respectively.

I cannot provide examples beyond these posts because most of the Clojure I do it private/proprietary :see_no_evil:

The version of ctags:

$ ctags --version
Universal Ctags 6.1.0(p6.1.20241117.0), Copyright (C) 2015-2023 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Nov 18 2024, 17:31:59
  URL: https://ctags.io/
  Output version: 0.0
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript, +pcre2

How do you get ctags binary: pacman on Arch Linux

masatake commented 5 days ago

I will accept pull requests to solve this issue. However, I will not work on this issue directly; I would like to solve it using a Sexp-based meta parser.

HOWEVER, '.b' test cases are welcome. People requesting to add parsers supporting new languages and/or to enhance parsers expect ctags developers to know the target languages. The expectation is wrong. The developers know only a tiny subset of the languages that ctags supports. Generally, the developers postpone the tasks related to unknown languages.

Preparing test cases is one of the ways to drive the developers. The test cases help the developers by reducing the time to learn the target language. See https://github.com/universal-ctags/ctags/issues/4065.

The value of test cases is immeasurable. We can add code to extract def* from the current implementation. I will call the code a direct solution. I want to avoid the direct solution. I want to implement a Sexp-based meta-parser that can be used as reusable routines to reimplement Lisp, EmacsLisp, Scheme, and Clojure parsers. I will call supporting def* in a new Close parser based on the meta parser an indirect solution. The test cases can be used in both solutions. A test case is an implementation neutral.

aartaka commented 5 days ago

Fair, I'll come up with test cases :+1:

masatake commented 5 days ago

Thank you. I would like you to read https://docs.ctags.io/en/latest/testing-parser.html#units-test-facility .