GithubHelp home page GithubHelp logo

tagbar.kak's People

Contributors

andreyorst avatar mogenson avatar scorchio avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

tagbar.kak's Issues

cannot open /tmp/ tag file

Problem description

tagbar returns an error complaining about not being able to access a tmp file.

Steps to reproduce

  1. echo "int main() {}" > test.cpp && kak test.cpp
  2. :tagbar-enable
  3. :buffer *debug*

What should happen

Tags should be displayed.

What happens instead

The buffer is displayed, but nothing is shown in it and the debug buffer display the following errors:

remote client connected: 4
shell stderr: <<<
There are no windows in the stack
Invalid window '%1'
Usage: windowactivate [options] [window=%1]
--sync    - only exit once the window is active (is visible + active)
If no window is given, %1 is used. See WINDOW STACK in xdotool(1)
>>>
shell stderr: <<<
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
readtags: cannot open tag file: No such file or directory: /tmp/tagbar.o9SDdhjn/tags
>>>
shell stderr: <<<
There are no windows in the stack
Invalid window '%1'
Usage: windowactivate [options] [window=%1]
--sync    - only exit once the window is active (is visible + active)
If no window is given, %1 is used. See WINDOW STACK in xdotool(1)
>>>

Environment information

OS: Ubuntu 20.04
Shell: bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
kakoune: be20a88
tagbar.kak: 6ed0ebb
kakrc: 558a6cf.

tagbar is empty

Problem description

It is a long time I don't use it.

Steps to reproduce

But I installed universal-ctags on last ubuntu release.
Kakoune on Ubuntu with package manager (strange, kak -version say Kakoune unknown)
I added the config for tagbar as adviced on github. And I did "plug-install"
ctags-generate command has been done. I can see the tags file in directory.
When I open a .cpp, the tagbar is open but is empty

Here is my kakrc used :
https://github.com/lauccode/config/blob/master/kakrc

Tagbar will not open on kitty terminal

I have had this problem consistently on kitty and I have succeeded in finding the source of the problem.

Main Problem

The problem was very simple: executing the :tagbar-enable command did not generate a new window. I tried it later on in xterm and it worked flawlessly, so i checked if it was because kitty wasn't configured properly, and I suspected I needed to have listen_on set to something and allow_remote_control set to yes

$ kitty --version
kitty 0.21.2 created by Kovid Goyal

Kitty configuration:

$ cat ~/.config/kitty/kitty.conf
font_size				15
font_family				Fira Code
bold_font				auto
italic_font				auto
bold_italic_font		auto
disable_ligatures		never


cursor_shape			beam

open_url_with			brave-browser
detect_urls				yes
enable_audio_bell		no

background_opacity		0.8
foreground				#bcc3cf
background				#17191c
#282c34

editor 					kak
window_padding_width	15
allow_remote_control	yes
listen_on               unix:/tmp/kitty_socket

Debugging

But this didn't seem to change anything (though I still suspect they are necessary for the plugin to use the kitty backend.

So i wnet ahead and had a look at the bash code for the plugin and I debugged until I found the source of the problem:

In the command definition for tagbar-display I found that everything worked fine within the if statement for the kitty backend:

    elif [ "$TERM" = "xterm-kitty" ]; then
        match=""
        if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
            match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
        fi

        listen=""
        if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
            listen="--to=$kak_client_env_KITTY_LISTEN_ON"
        fi
        kitty @ $listen launch --no-response --type="$kak_opt_kitty_window_type" --cwd="$PWD" $match kak -c ${kak_session} -e "${tagbar_cmd}"

Except for the last line which actually launched the kitty terminal, I therefore checked wether I could manually execute this on kitty (by simply echoing the contents of the kitty subcommand to a file and then executinf kitty with said subcommand)

...
        if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
            listen="--to=$kak_client_env_KITTY_LISTEN_ON"
        fi
+++ echo @ $listen launch --no-response --type="$kak_opt_kitty_window_type" --cwd="$PWD" $match kak -c ${kak_session} -e "${tagbar_cmd}" >> $HOME/file
        kitty @ $listen launch --no-response --type="$kak_opt_kitty_window_type" --cwd="$PWD" $match kak -c ${kak_session} -e "${tagbar_cmd}"
...

I then executed the above code simply by reopening kakoune and running :tagbar-enable on a random c project. Then I went to look at the file contents:

$ cat ~/file
@ --to=unix:/tmp/kitty_socket-497246 launch --no-response --type=kitty --cwd=/home/neosapien --match=id:1 kak -c 505670 -e try %{ buffer *tagbar* } catch %{ edit! -debug -scratch *tagbar* }
                rename-client %opt{tagbarclient}
                hook -group tagbar-watchers global FocusIn (?!tagbarclient).* %{ try %{ tagbar-update 'focus' } }
                hook -group tagbar-watchers global WinDisplay (?!\*tagbar\*).* %{ try %{ tagbar-update } }
                hook -group tagbar-watchers global BufWritePost (?!\*tagbar\*).* %{ try %{ tagbar-update } }
                hook -group tagbar-watchers global BufOpenFile (?!\*tagbar\*).* %{ try %{ tagbar-update } }
                hook -group tagbar-watchers global BufNewFile (?!\*tagbar\*).* %{ try %{ tagbar-update } }
                hook -group tagbar-watchers global WinSetOption tagbar_(sort|display_anon)=.* %{ try %{ tagbar-update } }
                focus client0

I then executed everything except for the kakoune specific commands:

$ kitty @ --to=unix:/tmp/kitty_socket-497246 launch --no-response --type=kitty --cwd=/home/neosapien --match=id:1 kak -c 505670

and got the following error message:

kitty is not a valid value for the --type option. Valid values are: tab, window, os-window, overlay, primary, background, clipboard

Conclusion

It turns out that the $kak_opt_kitty_window_type variable was outputting kitty which wasn't a valid option. I therefore solved the problem by selecting the option that suited my needs best by replacing the variable with os-window and it worked like a charm. I also tried the other options for good measure and they all worked as well.

TLDR

Tagbar wasn't opening in kitty and it was solvable by changing one line in the plugin from:

kitty @ $listen launch --no-response --type="$kak_opt_kitty_window_type" --cwd="$PWD" $match kak -c ${kak_session} -e "${tagbar_cmd}"

to:

kitty @ $listen launch --no-response --type="os-window" --cwd="$PWD" $match kak -c ${kak_session} -e "${tagbar_cmd}"

OSX Compatibility issue with awk

It seems that tagbar is not compatible with OSX's version of awk.

Using gawk in tagbar.kak instead of awk fixes this issue.

Would it be possible to test for gawk in the beginning and then use gawk or awk depending on which one is available?

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.