-
Notifications
You must be signed in to change notification settings - Fork 624
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
matlab: Parse variables in Matlab cod #571
Conversation
Fixes #570, but since there isn't proper variable declaration in Matlab every assignment is identified as a declaration of a variable. So this solution is less than ideal. |
@vhda thank you! Seems to work for me but I understand if you prefer not to merge it. No idea how to workaround the fact that Matlab doesn't have a proper variable declartion. |
Let's wait for comments from the rest of the team (who have been oddly quiet lately). |
@vhda ok. Thanks once again. |
@vhda, I'm sorry I'm bit busy now.
In my example A is tagged twice, this is what you don't want? I would like to know idea case for future development. |
Your guessing is correct. Generally speaking, a tag is created when a variable is declared. But this is a problem in languages like Matlab, where the syntax does not include variable declaration. This is also true in Python, which does not use a regex parser but it also generates two tags if we assign the same variable twice. So, at least we would be consistent even if we merge this PR. Going forward, it might make sense to create a mechanism where we only create a tag on the first occurrence in the current context. The context requirement would allow the use the same variable name in different functions, for example. This could probably not be too hard to implement in the cork mechanism, if I understood its functionality correctly. But parsers that do not use it will not benefit from the change. Yes, if #569 is merged, the second A should be marked as "reference". |
Yes. Let's merge this. Interesting topic. About cork, as you wrote, it is possible to implement what we need. After reading your comment, "reference" is not so simple. A name is referred variety reasons.
I wonder wheter ctags should deal with such detail or not. |
Not really sure if I completely understand the discussion but I just want to mention that with A <- 1
A <- 2 then two tags are generated for the variable |
@petobens, do you want ctags to make a tag entry for each "A" ? |
@masatake , I'm not really sure. I believe that a tag entry for the first one is definitely necessary. However tags for each entry might be useful . For example in Vim I use a tag explorer buffer: if there is an entry for each variable then I can see how that variables changes with each new assignment (this might be useful or not, I guess in the end it's a matter of personal preference). |
@petobens, thank you for explanation. I understand the second one is useful. However, the first one may be more important than the other. Anyway we will merge the change. |
@masatake great. Thank you! |
@masatake just noticed the typo in the subject of the commit. Allow me to fix it tonight and I'll merge the PR afterwards. |
@vhda, sure!. |
c480869
to
8600616
Compare
matlab: Parse variables in Matlab cod
Thank you!! |
No description provided.