nicolashainaux / symbols-tree-nav

A symbols view like taglist for Atom.io
MIT License
10 stars 6 forks source link

update universal-ctags binary shipped with the extension #12

Open artisdom opened 7 years ago

artisdom commented 7 years ago
$ ./universal-ctags-linux --help
Universal Ctags 0.0.0(6232f08), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: May 25 2016, 09:16:25
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +option-directory, +coproc, +xpath

Usage: universal-ctags-linux [options] [file(s)]

The shipped ctags binary is built last year,

  Compiled: May 25 2016, 09:16:25

which does not support gcc "Attribute Syntax"

use this test file: test.cc

static void func(D::S* s, E e __attribute__((unused)), void* p __attribute__((unused)))
{
    int i = 0;
}

static void func2(D::S* p)
{
    int i = 0;
}

The tags file generated by the shipped binary:

i   test3.cc    /^    int i = 0;$/;"    v   typeref:typename:int
func2   test3.cc    /^static void func2(D::S* p)$/;"    f   typeref:typename:void   file:

The tags file generated by the newly built local binary:

func    test3.cc    /^static void func(D::S* s, E e __attribute__((unused)), void* p __attribute__((unused)))$/;"   f   typeref:typename:void   file:
func2   test3.cc    /^static void func2(D::S* p)$/;"    f   typeref:typename:void   file:
nicolashainaux commented 7 years ago

If I understand well, you'd like to have a new binary. Do you know where is it possible to fetch a new one (for linux)? In the meanwhile you can use the related symbols-tree-nav setting to use your new local binary, instead of the one shipped with the extension (also had trouble with it).

artisdom commented 7 years ago

https://github.com/universal-ctags/ctags-win32 https://github.com/universal-ctags/homebrew-universal-ctags

looks like both win32 and osx has their dedicated repo to download or build the binary, not include linux.

After trying out a local build using the latest code of universal-ctags, there's still some parsing problem with C++. Now I have switched to the original "Exuberant Ctags", which works quite well for my case.

Thanks for the suggestion and this great package.

artisdom commented 7 years ago

By the way, I've made this local change to get the behavior that whenever a tag is clicked in the tree view, the text editor always scroll the corresponding code to the center of the screen. Do you think it would be possible to make this a default behavior, or add a configurable options to enable it dynamically ?

$ git diff
diff --git a/lib/symbols-tree-nav.coffee b/lib/symbols-tree-nav.coffee
index 7835e40..9445737 100644
--- a/lib/symbols-tree-nav.coffee
+++ b/lib/symbols-tree-nav.coffee
@@ -26,8 +26,8 @@ module.exports =
           {top, left, height, width} = editor.element.pixelRectForScreenRange(screenRange)
           bottom = top + height
           desiredScrollCenter = top + height / 2
-          unless editor.element.getScrollTop() < desiredScrollCenter < editor.element.getScrollBottom()
-            desiredScrollTop =  desiredScrollCenter - editor.element.getHeight() / 2
+          # unless editor.element.getScrollTop() < desiredScrollCenter < editor.element.getScrollBottom()
+          desiredScrollTop =  desiredScrollCenter - editor.element.getHeight() / 2

           from = {top: editor.element.getScrollTop()}
           to = {top: desiredScrollTop}
nicolashainaux commented 7 years ago

Yes, I will add an option in the next update (I do not have much time these days, but this should not be too long).

As to the binaries, thanks for the links. And well, updating the Windows one looks easy, but as there's no "official" binary for linux distributions nor OS X, I don't know what's the best to do. As to the linux one, I can compile one, but I do not want to provide a not compatible binary in a next release. As to the one for OS X, I even have no idea how I could compile it myself, at all.

artisdom commented 7 years ago

That will be great, thanks.

And I'm with you about the binaries, it's not easy to make sure the locally-produced binary would work on all systems. As the ctags path can be configured, it's working quite well for me now.

Cheers.

nicolashainaux commented 7 years ago

Just as a note: before any update of the binaries, do not forget that some breaking changes have been introduced in universal-ctags (in short: support for a .ctags configuration file has been replaced by a support for a configuration directory), and this might make updates of the binaries quite more complicated (unless there's a way to create a "universal" binary for linux and anyway, it will become necessary to use a configuration directory instead of the .ctags file)... so this won't be for the next release. Hope this won't be necessary too soon.