Closed jimkaiseriv closed 7 years ago
I'll look into the issue. By the way there is a fullproperty
completion for non-auto properties, but I can add completions for the Get and Set functions, and End* keywords.
Thanks for letting me know about the fullproperty completion. I can't believe I wasn't aware of it! That is certainly the kind of thing I was looking for. The added completions for Get, Set, etc. will certainly still be useful though.
Version 2.7.0 is out. I was not able to add completions for Get and Set functions without compromising an important check in the linter or resorting to extensive changes to how the linter works. I'll have to give some more thought to how this could be implemented and hopefully figure it out in the future.
Great! Thanks for looking into those completions, even though they could not be added for now. Out of curiosity, what caused the crash I experienced?
It was an edge case where one variable, which represented the view (basically the script that was being edited) that the linter was supposed to process, was set to None
when it should not have been. There was one scenario where that variable was expected to be None
and there was an if-statement to handle that and provide the necessary value another way, which would have been set up in advance. Seems like this was a perfect storm where the view variable was set to None
, but the "backup plan" preparations for the other (the expected) scenario had not been triggered and the plugin ended up attempting to access another variable that had not been declared at that point. Mistake on my part, but would have been discovered earlier with some proper static analysis (e.g. in a compiled language).
That makes sense. It did seem like an edge case. I doubt I could have easily reproduced the crash on my end, which was why I thought it was a little weird. I often drag and drop code around as I was there, temporarily breaking one thing or another in a function while I am rewriting it, and couldn't fathom what exactly triggered the error. Anyway, I'm glad you were able to find the problem.
I was working on re-writing the Get() function of a non-auto property when the crash occurred. I was inserting an if statement, and was moving some portion of the code so that it was inside the new conditional statement. I had written the if keyword, but not the endif keyword. My code selection accidentally included one line more than I had intended, and the return statement was grabbed and moved with it. Also, I had just grabbed and moved the return value (it was another function call) to an earlier point in the same function, assigning it to a variable which would contain the return value, but had not yet put the variable after the return statement, so that the line with the return statement did not have any return value. I noticed that something was wrong when I tabbed to indent a line, but instead the cursor jumped to the end of some other line further down, such as the EndFunction line, instead of indenting. The console output is below:
Traceback (most recent call last): File ".\sublime_plugin.py", line 190, in on_post_save File ".\sublime_plugin.py", line 154, in run_timed_function File ".\sublime_plugin.py", line 189, in
File ".\Plugin.py", line 174, in on_post_save
File ".\Plugin.py", line 398, in Linter
AttributeError: 'EventListener' object has no attribute 'scriptContents'
As an aside, but not related directly to the crash, I've noticed that there doesn't seem to be any completion features for writing non-auto properties. If I may make a small feature request, it would be to add completion functionality for the Get() and Set() Functions, as well as the EndProperty Keyword. This isn't really a big deal for me, though, but I thought I'd ask.
Thanks!
Jim