Comments (19)
I want to see something like this!
So as you cna see on this screenshot all variables of class highlighted with special color. That's look good. So how can I don it with you service ? For that look in vim I've used color_coded plugin. But you plugin working asynchroniously that sounds great, because color_coded doesn't work in such mode.
from yavide.
Hi @melonaerial,
I think that you may not be using yaflandia
colorscheme and that is why you don't see the effect of syntax highlighting. The reason you have to use that particular colorscheme is because standard colorschemes do not support displaying C/C++ symbols at that granularity (i.e. enums, enum values, local variables, functions, classes etc.). You have two choices here:
- Switch to the
yaflandia
colorscheme to see the effect of syntax highlighting instantly. - Use a colorscheme of your preference and tweak it a little bit to make it compatible with
Yavide
syntax highlighting service. For example, following file, cpp_syntax_highlight.vim, defines additional symbols which syntax service will understand (and generate) and those simply need to be mapped to particular colors in a colorscheme you want to use. See howyaflandia
colorscheme does it. It's trivial ... you just have to pick the colors for the given symbols: yaflandia.
However, under the hood Yavide
syntax highlighter utilizes ctags
to generate those symbols. ctags
actually isn't anymore the best solution for that purpose (even though it mostly does a decent job) but particularly it does not cope well with modern C++ code. Hence, my wish is to replace ctags
with clang
based approach which is, for example, used by color_coded
plugin but I haven't had much time recently to update the implementation.
Developing the async processing framework was what I was mostly focused on. This was my prio number one as without this framework implementing and integrating anything into the environment simply does not make any sense. Blocking the main UI thread while running the indexer/syntax highlighter/build/formatter/etc. was simply not an option.
from yavide.
Hello @JBakamovic ,
Thanks for such detailed answer. Yes, blocking UI thread is not an option and that's where cool that you have made such big work on async service. That's cool. But for colorsheme, I'm already using yaflandia from your repo, so it is default configuration of yavide and yaflandia is in default config. Maybe ctags doesn't work or something on my computer. Have can I see some debug information about running of Syntax hightlighting service ?
from yavide.
Hi @melonaerial,
I've tried out your test project on my machine and syntax highlighting seems to be running fine. Did you forget to import the project? You need to create a yavide
project in order to get all the services running. Handling projects is easy as it can be and amongst other things it is described in usage document. Following is a small excerpt from that documentation:
<Ctrl-s>n
Create new project<Ctrl-s>i
Import project with already existing code base<Ctrl-s>o
Open project<Ctrl-s>c
Close project<Ctrl-s>s
Save project<Ctrl-s>d
Delete project
So, you can try to create a new yavide
project by importing already existing code base (see 2.).
from yavide.
Hi @melonaerial,
With commit 9d44c4b
I have released an update of syntax highlighting service. It is now using a libclang
based back-end. You should now be able to get more satisfying results. See docs for more details.
You can give it a try if you feel like and let me know how it went :)
P.S. Don't forget to update the colorscheme as well by running cd <yavide_install_dir>/colors/yaflandia && git pull
. It's not automated yet :/
from yavide.
Im having the same problem both in Windows 10 and Lubuntu vm version.
from yavide.
Did you try out the steps above, i.e. import a project? You will not get any services running until you create a project context.
from yavide.
I created a test project
from yavide.
from yavide.
Hm, in the video I can see that the file you're editing is test.cpp
but I cannot see that file in the file-explorer on the left-hand side. Is this file part of that directory? If not, then it is not going to work like that.
Otherwise, you can attach the log which you can find under /tmp/YAVIDE_server.log
so I can have a look what is happening.
from yavide.
The file exists in the directory but does not appear in nerdtree.
YAVIDE_server.log - there seems to be an error
[INFO] [yavide_server.py:124] yavide_server_run(): Starting a Yavide server ...
[INFO] [yavide_service.py:17] __init__(): Yavide instance: YAVIDE
[INFO] [yavide_service.py:18] __init__(): Actions: {0: <bound method SourceCodeModel.__startup_request of <services.source_code_model_service.SourceCodeModel instance at 0x7fb58ffe3758>>, 1: <bound method SourceCodeModel.__shutdown_request of <services.source_code_model_service.SourceCodeModel instance at 0x7fb58ffe3758>>, 2: <bound method SourceCodeModel.__request of <services.source_code_model_service.SourceCodeModel instance at 0x7fb58ffe3758>>}
[CRITICAL] [yavide_server.py:99] handle_exception(): Uncaught exception
Traceback (most recent call last):
File "/opt/yavide/core/server/yavide_server.py", line 128, in yavide_server_run
YavideServer(msg_queue, yavide_instance).listen()
File "/opt/yavide/core/server/yavide_server.py", line 16, in __init__
0x0 : SourceCodeModel(self.msg_queue, self.yavide_instance),
File "/opt/yavide/core/services/source_code_model_service.py", line 14, in __init__
self.parser = ClangParser()
File "/opt/yavide/core/services/parser/clang_parser.py", line 71, in __init__
self.index = clang.cindex.Index.create()
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 2218, in create
return Index(conf.lib.clang_createIndex(excludeDecls, 0))
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 141, in __get__
value = self.wrapped(instance)
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 3575, in lib
lib = self.get_cindex_library()
File "/usr/local/lib/python2.7/dist-packages/clang/cindex.py", line 3606, in get_cindex_library
raise LibclangError(msg)
LibclangError: libclang.so: cannot open shared object file: No such file or directory. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
from yavide.
I'll start writing the instructions for Windows once I get it working in the vm.
from yavide.
You're missing a libclang.so
dependency. It should have been installed with the install.sh
script though. I am not sure why is that not the case but nevertheless you can install this dependency very easily by yourself. Not sure which distro are you running, but instructions to install it would be distro-specific and are usually straightforward.
Let me know if that fixed the issue for you.
from yavide.
Have not found the solution. What distro are you running it in?
from yavide.
Nevermind, I got it to work. I had to edit the cindex.py file in the clang python directory.
from yavide.
I am running Fedora almost exclusively and I haven't experienced such issues. So, if I understood you well, you had libclang.so
installed on your system but cindex.py
was not able to set the right path to it? Which distro are you running? Can you please share what modification you did so others having the same issue can benefit from it?
from yavide.
OS: Lubuntu and Ubuntu in Windows 10
First I tested this code in the python shell with the different paths until I did not get the error:
import clang
import clang.cindex
clang.cindex.set_library_file( {DIRECTORY} )
index = clang.cindex.Index.create()
In my case the one that worked was: /usr/lib/x86_64-linux-gnu/libclang-4.0.so.1
Then I hardcoded the file path in the cindex.py file located in /usr/local/lib/python2.7/dist-packages/clang/cindex.py
in this line.
from yavide.
Although it is not autocompleting the algorithms standard library
from yavide.
Hm, auto-completion is handled via clang_complete. I would expect that it should be working out-of-the-box for STL but if not, you can edit .clang_complete
file which is located in the root of your project directory. This file should include paths to system include directories as well as include directories specific to your project: i.e. -I
flag with corresponding paths that you would normally pass to your compiler.
With respect to libclang.so
path problem, I believe that the culprit is that libclang library is not part of your system dynamic linker cache configuration and that is the reason why cdll.LoadLibrary('libclang.so')
is failing for your system. You can easily check that by running the following command: ldconfig -p | grep libclang.so
. I believe the output will be empty in your case. In my case it looks like:
libclang.so.3.9 (libc,x86-64) => /lib64/libclang.so.3.9
libclang.so (libc,x86-64) => /lib64/libclang.so
If my assumptions are right then you will be able to fix the problem by tweaking the LD_LIBRARY_PATH
so it includes the directory where libclang library resides. It's a cleaner solution as it does not require you to mess up with the cindex.py
.
from yavide.
Related Issues (20)
- Error when executing: "function Y_Env_Init[2]..Y_ServerStart" HOT 8
- Multiple errors on startup. HOT 5
- Debian issues with libclang HOT 15
- vim-gnome on Debian buster links with python3 HOT 3
- Is it plan to include some kind of debugging tool? HOT 1
- using neovim as base? HOT 2
- how to use it with gdb, keymap for no-gui HOT 1
- Unable to start Yavide HOT 14
- Getting started documentation required HOT 2
- Add support for colorized parentheses HOT 1
- Could not build project by shortcut HOT 1
- Very strange behavior with autocomplete HOT 6
- Python clang binding not functioning correctly in line 8 of clang_parser.py. (clang_complete not working) HOT 1
- Aborting while importing a project HOT 2
- Add highlight for some cpp keywords
- Errors on startup and while typing HOT 4
- Feature Request: Implement 'Open call hierarchy'
- Installation on fedora 29 HOT 1
- chown cannot access destop not a directory, Elementary OS HOT 2
- Failing to run yavide
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yavide.