-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vim: support ":const" command which sets constants #2593
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2593 +/- ##
=======================================
Coverage 86.67% 86.67%
=======================================
Files 183 183
Lines 38608 38610 +2
=======================================
+ Hits 33462 33464 +2
Misses 5146 5146
Continue to review full report at Codecov.
|
I will asisst you. So the level is not a matter for us. We know ctags. You know vim script. I know C. Your knowledge about vim script is very important. You reuse the code for handling "let". However, as far as my short study, let is for defining variables.
=>
Here |
I think ideal behavior is:
The change we need is for above result:
However, I don't know well about vim script. So, I would like to hear your comments. |
I agree with you; technically, a constant is not a variable since its value can't change. I've applied your patch, compiled and installed. All the Vim tests still pass, and the |
I made a mistake in the |
parsers/vim.c
Outdated
@@ -594,11 +596,14 @@ static bool parseVimLine (const unsigned char *line, int infunction) | |||
parseAutogroup (skipWord (line)); | |||
} | |||
|
|||
else if (wordMatchLen (line, "let", 3)) | |||
else if (wordMatchLen (line, "let", 3) || wordMatchLen (line, "const", 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mathcing "const" is not needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I forgot to revert my old patch, sorry.
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removng this empty line is not needed to support "const".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fixed; I added back the empty line.
Thank you. |
This PR tries to add support for the Vim command
:const
. The latter is used in Vimscript to set a constant.I did not try to create a new C function to parse the command because:
:const
is equivalent to:let
followed by:lockvar
; it's just a variable whose value is locked so that it can't change.:const
can be shortened into:cons
, which is why I wrote4
and not5
here:I added a simple test consisting of an input file and an expected output tags file.
I made sure all the Vim tests passed: