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

How to use kotlin.ctags #8

Closed
wuseal opened this issue Jul 30, 2020 · 8 comments
Closed

How to use kotlin.ctags #8

wuseal opened this issue Jul 30, 2020 · 8 comments

Comments

@wuseal
Copy link

wuseal commented Jul 30, 2020

Hello, After putting the content in kotlin.ctags into ~/.ctags file. I run this command:
ctags --list-languages
It doesn't contains Kotlin.

Ada
Ant
Asciidoc
Asm
Asp
Autoconf
AutoIt
Automake
Awk
Basic
BETA
BibTeX
C
C#
C++
Clojure
CMake
Cobol
CPreProcessor
CSS
Ctags
CUDA
D
DBusIntrospect
Diff
DosBatch
DTD
DTS
Eiffel
Elixir
Elm
EmacsLisp
Erlang
Falcon
Flex
Fortran
Fypp
Gdbinit
Glade
Go
HTML
Iniconf
Inko
ITcl
Java
JavaProperties
JavaScript
JSON
Kconfig
LdScript
Lisp
Lua
M4
Make
Man
Markdown
MatLab
Maven2
Moose
Myrddin
NSIS
ObjectiveC
OCaml
OldC [disabled]
OldC++ [disabled]
Pascal
Passwd
Perl
Perl6
PHP
PlistXML
Pod
PowerShell
Protobuf
PuppetManifest
Python
PythonLoggingConfig
QemuHX
QtMoc
R
RelaxNG
ReStructuredText
REXX
Robot
RpmSpec
RSpec
Ruby
Rust
Scheme
SCSS
Sh
SLang
SML
SQL
SVG
SystemdUnit
SystemTap
SystemVerilog
Tcl
TclOO
Tex
TeXBeamer
TTCN
TypeScript
Unknown [disabled]
Varlink
Vera
Verilog
VHDL
Vim
WindRes
XML
XSLT
YACC
YumRepo
Zephir

I am using Universal-ctags.

Hi, Bro, I need your help 😢

@daveyarwood
Copy link
Owner

My file is located at ~/.ctags.d/kotlin.ctags. Give that a try and see if it fixes the issue.

@wuseal
Copy link
Author

wuseal commented Jul 31, 2020

@daveyarwood Hi, Thanks for you reply.
After putting the content in ~/.ctags.d/kotlin.ctags as you said, It seems do work, but there is an error throw out when I run
ctags --list-languages

ctags: Non-alphanumeric char is used in kind name: 'data classes' in "--regex-kotlin" option

May something not compatible with current Universal-ctags?

@wuseal
Copy link
Author

wuseal commented Jul 31, 2020

Hi, I follow the solution here:https://gist.github.com/kittinunf/25484de6294a0c4263c86dda3aa1580c#gistcomment-3171742

Because you can't have spaces in Kind names. Replacing line 6 with the line below fixes the problem.
--regex-kotlin=/^[[:space:]]*((abstract|final|sealed|implicit|lazy|open)[[:space:]]*)*(private[^ ]*|protected)?[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*data[[:space:]]+class[[:space:]]+([[:alnum:]_:]+)/\6/d,dataclasses/

It works for me.
Thank you for your help, best wishes to you 😄

@wuseal wuseal closed this as completed Jul 31, 2020
@wuseal wuseal reopened this Jul 31, 2020
@wuseal
Copy link
Author

wuseal commented Jul 31, 2020

It seems do not work with TagbarToggle
image
No file tags could be found 😢

@daveyarwood
Copy link
Owner

Are you generating the ctags? You can do it manually with ctags -R followed by the directory that your source code is in. For example, ctags -R . or ctags -R src

Having to do this manually every time your source code changes would be really annoying, so there are Vim plugins to automate it. I use https://github.com/ludovicchabant/vim-gutentags and it works well.

@masatake
Copy link

You will be interested in universal-ctags/ctags#2769.

@daveyarwood
Copy link
Owner

Nice! Looks like I might be able to simplify my setup once that is released.

@daveyarwood
Copy link
Owner

I've since deleted my Kotlin ctags config, as there now seems to be good built-in support for Kotlin (possibly related to the commit linked above).

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

No branches or pull requests

3 participants