Comments (9)
ctags don't support unicode
It looks universal-ctags has limited unicode support, you can have a try.
https://github.com/universal-ctags/ctags
from gen_tags.vim.
Oh, sorry. I misunderstand your issue.
Maybe this issue was imported in the rewrite of ctags_prune().
I am still in the holiday of national day, I'll look into this issue later.
from gen_tags.vim.
I looked into this issue.
My universal-ctags version is download from https://github.com/universal-ctags/ctags-win32/releases/download/2018-10-08%2F208e2c0b/ctags-2018-10-08_208e2c0b-x64.zip
$ ctags --version
Universal Ctags 0.0.0(208e2c0b), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Oct 8 2018, 00:08:42
URL: https://ctags.io/
Optional compiled features: +win32, +wildcards, +regex, +internal-sort, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +case-insensitive-filenames
If the source code path is pure English, ctags will generate a tags
file with charset 'us-ascii' which will be treat as 'utf-8' in python
$ ctags -R d:\ethtool
$ file tags --mime-encoding
tags: us-ascii
And if the path with CJK inside, the tags
file will be use the OS native charset
$ ctags -R d:\测试ethtool
$ file --mime-encoding tags
tags: iso-8859-1
But in python, the data read from file will be treat as utf-8 by default, that's why you got this issue.
I'm not familiar with python, it looks the data need some convert before comparison.
The workaround you provide only mute the error message, but the ctags_prune()
is still not work.
Maybe you should not use CJK in path or disable g:gen_tags#ctags_prune
before we got a solution.
from gen_tags.vim.
I have been using universal ctags, though my build is a bit older.
Universal Ctags 0.0.0(f4be7435), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Sep 27 2018, 00:07:08
URL: https://ctags.io/
Optional compiled features: +win32, +wildcards, +regex, +internal-sort, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +case-insensitive-filenames
All paths are in English and the tags file is in ascii.
> file .\prj_tags --mime-encoding
> .\prj_tags: us-ascii
As I mentioned I think it has to do with the path containing "C:\Users" as mentioned in here. The error does not occur if the path does not contain \U
. Moving the project outside of C:\Users to a different folder or drive makes the error go away.
If I print out the paths you can see that the l:file
variable isn't having it's path fixed.
echom l:tagfile
echom l:file
"Prune tags content for saved file
if g:gen_tags#ctags_prune
call s:ctags_prune(l:tagfile, l:file)
endif
C:/Users/kyle/Workspace/Trunk&Std/clean_trunk/.svn/tags_dir/prj_tags
C:\Users\kyle\Workspace\Trunk&Std\clean_trunk\MyApplication\Application.c
I thought fixing the escape sequence in the prune
function in prune.py
would have fixed it as well but the error remains after trying this:
f = open(tagfile.encode('unicode-escape').decode('ascii'), 'w')
How can you tell that ctags_prune()
is not working? When I have my workaround in place, the prj_tags
file is still written and contains properly escaped paths like this:
MK22FA12.h C:\\Users\\kyle\\Workspace\\Trunk&Std\\clean_trunk\\Executables\\source\\Application.c /^#include "MK22FA12.h"/;" h
Let me know if there is anything you would like me to try out.
from gen_tags.vim.
with ctags_prune enabled, tag for current buffer will be deleted on save.
And append to the end of the tag file after update procedure done.
But with the workaround, I can't see that behavior.
from gen_tags.vim.
https://github.com/jsfaint/gen_tags.vim/tree/fix_unicode
I rewrite ctags_prune()
with pure vimscript which resolve this issue.
I do some profile on different platform, the performance is accpetable compare to the python version.
@embedded-kyle Can you have a try?
from gen_tags.vim.
Updated and switched branches. The error is gone and the tags file was updated with the correct timestamp.
I still don't fully understand the structure of the tag file so I can't confirm that it updated correctly. I was editing Application.c which contains the primary task that my RTOS runs. The last two lines in the tag file are links for the "µVision build Log" but that only seems to be because the file is organised alphabetically?
Let me know if there is something specific that you would like me to try or to look for to confirm that this fix is working properly. I'm happy to help. Thanks for the update.
from gen_tags.vim.
Yes, the tag is sorted by default
We can disable the sort behavior by add -u
for ctags.
I already test on different platforms (Windows, Linux and macOS)
I think I can merge that branch now.
Thanks for your help @embedded-kyle 👍
from gen_tags.vim.
I think we can close this issue now.
@embedded-kyle thanks again 😄
from gen_tags.vim.
Related Issues (20)
- Can I redir search result to quickfix list HOT 8
- if HOME path contain backspace on windows, it doesn't work HOT 2
- gtags keymapping is not working HOT 9
- file save will lost tag data HOT 6
- If the previous GenGTAGS exit abnormally, it will not be updated by use GenGTAGS again HOT 2
- ctags can't add g:gen_tags#ctags_opts parameter , it would pop "-f option may not follow a file name" HOT 16
- [question] Can I use Gtags for jump instead of ctags? HOT 5
- [feature request] support ncm2 source HOT 3
- Clipbord is contaminated HOT 11
- Increase Python 3's priority. HOT 2
- 关于结果很多的时候 HOT 4
- add option to use only ctags HOT 2
- g:gen_tags#global_opts HOT 1
- g:gen_tags#use_cache_dir creates useless directories when used with vim-fugitive HOT 3
- [feature request] Highlight tags HOT 3
- Tags file not sorted error HOT 19
- set ctag rules per filetype HOT 2
- Rebuild tags after branch change HOT 2
- When the directories configured by scm (.git, .hg, .svn) and g:gen_tags#root_marker both exist, the problem that the configuration of g:gen_tags#root_marker is invalid HOT 1
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 gen_tags.vim.