Kapiainen / SublimePapyrus

A Sublime Text 2 and 3 package for the Papyrus scripting language.
MIT License
47 stars 8 forks source link

Focus being stolen #15

Closed Nikey646 closed 8 years ago

Nikey646 commented 8 years ago

First off: This is not talking about the Selection Focus, but the Screen Focus.

I believe this is related to the Linter portion of the Skyrim Syntax. Whenever there is an error in the .psc file, it will jump to that line and put it in the center of my screen. Great, incredibly helpful...until every time i modify the source code it steals focus from where i was, to try and show me the error i already knew about.

It would be great if you stored the last errors line #, and ensured that the # didn't change >2 lines before stealing focusing.

Reproducible steps: On a large .psc file (I was modifying a 2.7k line script), copy and paste an if statement on a variable, and change the variable name. Return to the top of the script to create the new variable for it, and do the same for the properties (Lazy coding ftw :>), but after pasting the property, the focus will be returned to the last error.

Also, are you taking feature requests? If so, i have one but not sure if it's possible to (cleanly) implement.

Kapiainen commented 8 years ago

There is a setting, _center_highlightedline, that you can modify in order to disable the behavior you are talking about. Go to Preferences > Package Settings > SublimePapyrus > Settings - User and copy and paste the following: "center_highlighted_line": false

What is the feature you are thinking about?

Nikey646 commented 8 years ago

The thing is that i want to keep the feature, i just don't want it to occur every time i change something (Sort of a cache, only centering the highlighted line when it the line changes)

As for the feature, it appear user error was preventing what i wanted, and you can absolutely ignore that portion of the question!

Kapiainen commented 8 years ago

Do you mean that the line that causes the error should not be brought to the center of the screen while you are editing that line? So that the line could be kept at the bottom or top of the screen without having the line being brought to the center if the linter finds an issue with the partially finished line?

Nikey646 commented 8 years ago

No no, The current way it handles it is fine.

What happens when you go to edit a line at the top of the file, the linter finds the same error again, and centers the problematic line again, when i'm in the middle of fixing the issue (In the case this occured was a missing variable)

Kapiainen commented 8 years ago

I think I now understand what you mean.

Kapiainen commented 8 years ago

The upcoming version will include tracking of errors until the linter no longer finds errors. A previously encountered error (or what is assumed to be the same error based on the message and the line it is on) is no longer centered more than once unless the line it is on has changed by more than the value defined in a new user setting (default: 2 lines).

I still need to do some more testing (the update contains over 20 additions, changes, and fixes), update the readme, and merge the update branch into the master branch. The new version will hopefully be available by the end of this week. If you want to try it out already, then you can clone the 'next-update' branch, build the packages (the script is developed on Python 3.x, but might work in Python 2.x as well), and copy the generated .sublime-package files to the correct folder as you would normally.

Kapiainen commented 8 years ago

The new version is out.