bigfish / vim-js-context-coloring

JavaScript Context Coloring in Vim
MIT License
151 stars 8 forks source link

Higlighting not working after installation #24

Closed mschaaf closed 8 years ago

mschaaf commented 8 years ago

Hej,

I installed the plugin and verified that it is loaded by calling the command JSContextColorToggle. But an opened js file is not context coloured. I enabled debugging but did not get any extra message. Would be nice if you could help me on getting the plugin to work on my system.

At the end, I set the following options:

let g:js_context_colors_enabled = 1
let g:js_context_colors_show_error_message = 1                                                                                                                                                                                                        
let g:js_context_colors_debug = 1                                                                                                                                                                                                 
let g:js_context_colors_jsx = 1
bigfish commented 8 years ago

so it works but only by calling the command manually? You're just using the master branch I presume, can you also provide: output of vim command: :version your OS

mschaaf commented 8 years ago

Sorry for the confusion, but no it didn't work with the manual call. I only verified that the commands are available and the plugin is loaded with this call.

OS: Ubuntu 16.10 VIM :version

:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 16 2016 15:35:34)
Inklusive der Korrekturen: 1-41
Verändert von pkg-vim-maintainers@lists.alioth.debian.org
Übersetzt von pkg-vim-maintainers@lists.alioth.debian.org
Riesige Version with GTK3 GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften:
+acl             +cindent         +cryptv          -ebcdic          +float           +job             +listcmds        +mouse_dec       +multi_byte      +persistent_undo +rightleft       +syntax          +textobjects     +visualextra     -xfontset
+arabic          +clientserver    +cscope          +emacs_tags      +folding         +jumplist        +localmap        +mouse_gpm       +multi_lang      +postscript      +ruby            +tag_binary      +timers          +viminfo         +xim
+autocmd         +clipboard       +cursorbind      +eval            -footer          +keymap          +lua             -mouse_jsbterm   -mzscheme        +printer         +scrollbind      +tag_old_static  +title           +vreplace        +xpm
+balloon_eval    +cmdline_compl   +cursorshape     +ex_extra        +fork()          +lambda          +menu            +mouse_netterm   +netbeans_intg   +profile         +signs           -tag_any_white   +toolbar         +wildignore      +xsmp_interact
+browse          +cmdline_hist    +dialog_con_gui  +extra_search    +gettext         +langmap         +mksession       +mouse_sgr       +num64           -python          +smartindent     +tcl             +user_commands   +wildmenu        +xterm_clipboard
++builtin_terms  +cmdline_info    +diff            +farsi           -hangul_input    +libcall         +modify_fname    -mouse_sysmouse  +packages        +python3         +startuptime     +termguicolors   +vertsplit       +windows         -xterm_save
+byte_offset     +comments        +digraphs        +file_in_path    +iconv           +linebreak       +mouse           +mouse_urxvt     +path_extra      +quickfix        +statusline      +terminfo        +virtualedit     +writebackup
+channel         +conceal         +dnd             +find_in_path    +insert_expand   +lispindent      +mouseshape      +mouse_xterm     +perl            +reltime         -sun_workshop    +termresponse    +visual          +X11
          System-vimrc-Datei: "$VIM/vimrc"
        Benutzer-vimrc-Datei: "$HOME/.vimrc"
 zweite Benutzer-vimrc-Datei: "~/.vim/vimrc"
         Benutzer-exrc-Datei: "$HOME/.exrc"
         System-gvimrc-Datei: "$VIM/gvimrc"
       Benutzer-gvimrc-Datei: "$HOME/.gvimrc"
zweite Benutzer-gvimrc-Datei: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
           System-Menü-Datei: "$VIMRUNTIME/menu.vim"
     Voreinstellung für $VIM: "/usr/share/vim"
Übersetzt: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/incl
ude/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-
1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-secur
ity -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linken: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -
latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/
lib  -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpt
hread -lgmp -ldl -lcrypt -lm
bigfish commented 8 years ago

thanks for the info, I will test with Vim8 on Ubuntu to see if I can reproduce this

bigfish commented 8 years ago

yup, looks like some things got dropped on last commit to master branch. I've restored them now, so try pulling the repo again, do npm install in the repo dir, and see if it works?

mschaaf commented 8 years ago

I pulled your last commit and did an npm install, but it is still not context colouring the file.

bigfish commented 8 years ago

hmm. what are the file contents? It doesn't handle unreleased es6 features (eg. object spread) Does it work for plain es5 script? No debug output?

mschaaf commented 8 years ago

It is es6 but I have to check with es5. After toggling I can see shortly some text, it looks like the json from the command line tool. If I use for the same file the CLI directly it prints out json and as far as I can tell it recognizes contexts, but I will check with an easier file.

bigfish commented 8 years ago

yeah if you see json the backend is working... perhaps its not finding the colors file

mschaaf commented 8 years ago

Ok I opened the CLI file from the plugin with vim and that one is colourized, but not my *.js files. The difference I see is that the CLI file is recognised as javascript type and my js files as javascript.jsx.

mschaaf commented 8 years ago

Is there some debug output I can get?

bigfish commented 8 years ago

I have an idea what's going on, just a sec

mschaaf commented 8 years ago

The current example I use is:


//
//
//
//
var t = null;
t = function() {
  d = function() {
    a = 1;
    c = function () {
      var l = 1 + 1;
    };
  };

};
bigfish commented 8 years ago

so it only doesn't work for .jsx files?

bigfish commented 8 years ago

hm, it works for me on .jsx, it says filetype is javascript. What filetype does it display for you? Does it work if you say :set ft=javascript

bigfish commented 8 years ago

oh I see, you said its javascript.jsx

mschaaf commented 8 years ago

Hmm, maybe this is the hint all my js files are recognised as javascript.jsx, but they are not jsx files. They are plain js with the file ending js. The CLI javascript file has no js ending and is the only one that is recognised as pure javascript. I will check why that is until now it was no issue.

It displays javascript.jsx for my files. Set ft=javascript works and enables the colouring.

bigfish commented 8 years ago

ah, ok. May be due to some jsx syntax file you're using. I should support javascript.jsx filetype however.

mschaaf commented 8 years ago

Yes, I have vim-jsx installed and you are right javascript.jsx is also a javascript file type. Thanks for the help.

mschaaf commented 8 years ago

I guess it is that line if &filetype == 'javascript' && ... int javascript.vim file. I will try to open a pull request.

bigfish commented 8 years ago

ah, good catch, I have a fix for that on the neovim branch, I can merge it over

bigfish commented 8 years ago

I pushed a fix for that...

bigfish commented 8 years ago

ah, my vim-jsx was out of date, the ft detection changed

bigfish commented 8 years ago

ok, looks like initial colorizing is still not working though.. i think that's because it's triggered by ./after/syntax/javascript.vim

bigfish commented 8 years ago

ok, I pushed again. Try now?

mschaaf commented 8 years ago

The initial colouring is now working, Thanks for your help.

bigfish commented 8 years ago

ok, great, thanks for your help in debugging it.