-
Notifications
You must be signed in to change notification settings - Fork 793
reflecting the scopes and folding in xref generation #1668
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
Conversation
|
I think you just miss a fix for unit tests ... otherwise it looks OK |
|
I adapted the tests by turning off scopes and I added one tests where scopes are enabled |
|
From maintenance perspective I don't like the addition of verbatim HTML code too much. Ideally it should be parsed to be get the scopes. |
|
For test purpose this seems ok to me now, taken into account that I only followed the other test case in this package. Of course a kind of less strict test would be welcomed. |
| lxref.reInit(in); | ||
| lxref.annotation = annotation; | ||
| lxref.project = project; | ||
| lxref.setScopesEnabled(RuntimeEnvironment.getInstance().isScopesEnabled()); |
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.
As far as I understand this and AnalyzerGuru.java#writeXref() are used only for testing. Otherwise during normal indexing the xref is created via this path:
IndexDatabase#addFile()
FileAnalyzer fa = AnalyzerGuru.getAnalyzer() // fa can be e.g. CAnalyzer
AnalyzerGuru#populateDocument()
fa.analyze()
AbstractSourceCodeAnalyzer#analyze()
super.analyze()
PlainAnalyzer#analyze()
writeXref()
xref = newXref() // xref can be e.g. CXref
JFlexXref.write()
where the scopes/folding properties are in effect thanks to the inheritance and these lines in IndexDatabase#addFile():
662 fa.setScopesEnabled(RuntimeEnvironment.getInstance().isScopesEnabled());
663 fa.setFoldingEnabled(RuntimeEnvironment.getInstance().isFoldingEnabled());
So having these properties set into the writeXref() seems like short-circuiting however there is no other way given the method is static.
The only nit I have is that the call to reInit() in JFlexXref above contains:
scopes = new Scopes();
which is not necessary when scopes are disabled. Granted, this method does not do anything however it's a bit of wasted memory.
|
|
||
| protected void startScope() { | ||
| if (scopesEnabled && scope == null) { | ||
| if (scopesEnabled && scope == null && defs != null) { |
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.
is this fixing any misbehavior ?
fixes #1627