Skip to content

Allow custom language definitions - #876

Merged
raven42 merged 3 commits into
preservim:masterfrom
AndyMcAliley:custom_language
Jun 11, 2025
Merged

Allow custom language definitions#876
raven42 merged 3 commits into
preservim:masterfrom
AndyMcAliley:custom_language

Conversation

@AndyMcAliley

@AndyMcAliley AndyMcAliley commented Mar 8, 2024

Copy link
Copy Markdown
Contributor

Fixes #789

This PR adds a second duplicate --option directive to the ctags command, using deffile twice. The first --option comes prior to --language-force and lets ctags know the custom language. The second --option comes last to override the default --kinds-<lang> definition.

This PR addresses the same problem that #792 addresses, but in a different way that doesn't require additional user options.

This fix needs testing, especially on the use case described in #776.

@AndyMcAliley

AndyMcAliley commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

I added a commit to check if the language is recognized by ctags, and only include the first --option directive for custom languages, which is better. I added another commit to only call ctags --list-languages once.

@raven42 raven42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like this works correctly for both the original failing case #776 and the new language case #789

Thanks for the contribution!

@raven42
raven42 enabled auto-merge (squash) June 10, 2025 14:19
@raven42
raven42 disabled auto-merge June 10, 2025 14:36
@raven42
raven42 enabled auto-merge (squash) June 10, 2025 14:36
@raven42
raven42 disabled auto-merge June 11, 2025 12:58
@raven42
raven42 merged commit 2ef4ecb into preservim:master Jun 11, 2025
derbroti pushed a commit to derbroti/tagbar that referenced this pull request Jul 6, 2025
* Add second --option directive

* Only add first --options for custom language

* Save supported_types to avoid extra ctags calls

---------

Co-authored-by: Andy McAliley <AndyMcAliley@users.noreply.github.com>
Co-authored-by: Andy McAliley <wmcaliley@usgs.gov>
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.

#777 breaks the ability to add a definition for a new language or file type

4 participants