Skip to content

Commit 61cbced

Browse files
committed
Merge pull request #18 from Kapiainen/tooltip
Tooltip
2 parents f300430 + 6febdee commit 61cbced

File tree

6 files changed

+476
-196
lines changed

6 files changed

+476
-196
lines changed

Docs/example.gif

161 KB
Loading

README.md

+101-45
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ A Sublime Text 2 and 3 package for the Papyrus scripting language.
1313
## **Description**
1414
SublimePapyrus is a package that aims to provide a development environment for a scripting language called [Papyrus](http://www.creationkit.com/Category:Papyrus) within [Sublime Text](https://www.sublimetext.com/). The package is split into a core package and additional packages for specific games and/or resources. The core package is always required, but the other packages usually depend upon the core package or one of the other packages.
1515

16+
![Example](Docs/example.gif)
17+
18+
The example above shows the syntax highlighting, code completion, and tooltips in action ([*Moka Dark* theme](https://github.com/aldomann/sublime-moka) is used in the example).
19+
1620
## **How to install**
1721
- Download a [release](https://github.com/Kapiainen/SublimePapyrus/releases).
1822
- Start Sublime Text.
@@ -21,17 +25,19 @@ SublimePapyrus is a package that aims to provide a development environment for a
2125
- Open the release archive that was downloaded and extract the *.sublime-package* files to *"\Data\Installed Packages"*.
2226
- Restart Sublime Text.
2327

28+
Enabling Sublime Text's ***auto_complete_with_fields*** setting is highly recommended in order to get the best experience.
29+
2430
## **Core features**
25-
- Build system framework
31+
- [Build system framework](#build-system-framework)
2632
- Single file build
2733
- Batch build
2834
- Hide successful build results
2935
- Highlight build errors
30-
- Valid key insertion framework
31-
- Commands
36+
- [Valid key insertion framework](#valid-key-insertion-framework)
37+
- [Commands](#commands)
3238
- Open script
3339
- Clear error highlights
34-
- Settings
40+
- [Settings](#settings)
3541

3642
#### Build system framework
3743
The core of this package contains a flexible build system framework that should be able to handle most situations. The build system supports both single file and batch building, multiple import folders, and additional arguments. Lines in the source code that cause build errors can also be highlighted and brought to the center of the screen. Attempts to batch build one of the folders defined in the import folders setting will show a warning prompt. If no output folder is specified in the user settings, then the compiled script will be placed one level above the script source (e.g. *"\Scripts\Source\Example.psc"* is compiled to *"\Scripts\Example.pex"*).
@@ -62,6 +68,26 @@ Settings are located in *Preferences* > *Package Settings* > *SublimePapyrus*.
6268

6369
- ***intelligent_code_completion***: Enables the code completion system that uses cached results from the linter to provide context-aware completions. Default: True
6470

71+
- ***intelligent_code_completion_function_event_parameters***: Determines if function/event parameters should be included in completions for function/event calls. Default: True
72+
73+
- ***tooltip_function_parameters***: Determines if a tooltip shows up with information about the parameters of a function/event call that is being edited. Default: True
74+
75+
- ***tooltip_background_color***: Hex color code of a tooltip's background. Default: #393939
76+
77+
- ***tooltip_body_text_color***: Hex color code of a tooltip's text. Default: #747369
78+
79+
- ***tooltip_font_size***: The size (in pixels) of a tooltip's text. Default: 12
80+
81+
- ***tooltip_bold_text_color***: Hex color code of a tooltip's bold text. Default: #ffffff
82+
83+
- ***tooltip_heading_text_color***: Hex color code of a tooltip's heading. Default: #bfbfbf
84+
85+
- ***tooltip_heading_font_size***: The size (in pixels) of text in a tooltip's heading. Default: 14
86+
87+
- ***tooltip_max_width***: The maximum width (in pixels) of the tooltip. Default: 600
88+
89+
- ***tooltip_max_height***: The maximum height (in pixels) of the tooltip. Default: 300
90+
6591
- ***center_highlighted_line***: Automatically scrolls the view so that a highlighted line is in the center of the view. Default: True
6692

6793
- ***highlight_build_errors***: Highlights lines that cause attempts to compile scripts to fail. Default: True
@@ -87,11 +113,12 @@ Settings are located in *Preferences* > *Package Settings* > *SublimePapyrus*.
87113
- [Immersive First Person View](#immersive-first-person-view-ifpv)
88114

89115
### **The Elder Scrolls V: Skyrim**
90-
- Syntax highlighting
91-
- Linter
92-
- Intelligent code completion
93-
- Build system
94-
- Commands
116+
- [Syntax highlighting](#syntax-highlighting)
117+
- [Linter](#linter)
118+
- [Intelligent code completion](#intelligent-code-completion)
119+
- [Tooltips](#tooltips)
120+
- [Build system](#build-system)
121+
- [Commands](#commands-1)
95122
- Generate completions
96123
- Valid key insertion
97124
- Actor value
@@ -108,11 +135,11 @@ Syntax highlighting for the version of Papyrus that is used in ***The Elder Scro
108135
Requirements:
109136
- The linter has to be enabled in the settings.
110137

111-
The linter performs lexical, syntactic, and semantic analysis on the source code of scripts as they are being edited. Lines that cause errors are highlighted and the error messages are shown as status messages (bottom left corner of Sublime Text).
138+
The linter performs lexical, syntactic, and semantic analysis on the source code of scripts as they are being edited and/or when they are saved. Lines that cause errors are highlighted and the error messages are shown as status messages (bottom left corner of Sublime Text).
112139

113140
Caching is used by the linter in order to improve performance and cache invalidation only occurs in a few scenarios. Modifications to the import folders setting (e.g. changing the order of paths) requires a restart of Sublime Text in order to clear the cache and ensure that the right scripts are being used.
114141

115-
The linter does work in Sublime Text 2, but error messages and highlighting is not possible due to technical limitations, which do not apply to Sublime Text 3, regarding the API in Sublime Text 2 when the linter is triggered by editing a script. Error messages and highlighting is possible in Sublime Text 2 when the linter is triggered by saving a script.
142+
The linter does work in Sublime Text 2, but error messages and highlighting is not possible when the linter is triggered by editing a script due to technical limitations in the API of Sublime Text 2. Error messages and highlighting is possible in Sublime Text 2 when the linter is triggered by saving a script.
116143

117144
Information about settings relevant to the linter can be found **[here](#settings)**.
118145

@@ -129,14 +156,25 @@ The intelligent code completion system utilizes the linter to produce suggestion
129156

130157
- Return completions for all scripts that exist within the import folders that have been defined in the package settings.
131158

132-
- Return keyword completions are also returned on the basis of the context of the line that is being edited.
159+
- Return keyword completions based on the context of the line that is being edited (e.g. applicable function/event/property flags).
133160

134-
- Provide information about the object behind the completion (e.g. a function's return type, a variable's type, whether a variable is a function/event parameter).
161+
- Provide information about the object behind the completion (e.g. a function's return type, a variable's type, whether a variable is a function/event parameter, the origin of the completion).
135162

136163
Caching is used by the intelligent code completion system in order to improve performance. Saving a script invalidates the portions of the cache that would be affected by modifications to that script.
137164

138165
There is a [setting](#settings) to turn this feature off. If this feature is disabled, then one can generate completions with the ***Generate completions*** command, but these completions will show up as suggested completions regardless of the context.
139166

167+
#### Tooltips
168+
Requirements:
169+
- The feature has to be enabled in the settings.
170+
- The same requirements as in the case of the linter.
171+
- Sublime Text 3 build 3070 or newer.
172+
173+
Shows additional information. The appearance of tooltips can be customized (e.g. font size, color, maximum dimensions) via the settings.
174+
175+
Currently supported tooltips:
176+
- Show information about the function/event call that is being edited. The displayed information includes the name of the function/event, the parameters and their default values, and which parameter corresponds to the argument that is being edited. This feature can be toggled in the settings.
177+
140178
#### Build system
141179
Single file build system and a batch build variant.
142180

@@ -153,7 +191,7 @@ Single file build system and a batch build variant.
153191
- Game setting names (float, integer, and string)
154192

155193
- Clear cache
156-
- Clears the caches relevant to the linter and code completion. Can be used to refresh the linter and code completion after modifying the contents of the *import* setting (e.g. adding a new folder or changing the order of folders) or the contents of one of the folders specified in the *import* setting (e.g. saving a new script).
194+
- Clears the caches relevant to the linter and code completion. Can be used to refresh the linter and code completion after modifying the contents of the ***import*** setting (e.g. adding a new folder or changing the order of folders) or the contents of one of the folders specified in the ***import*** setting (e.g. saving a new script).
157195

158196
#### **3rd party resources for Skyrim**
159197
##### Skyrim Script Extender (SKSE)
@@ -182,6 +220,24 @@ Single file build system and a batch build variant.
182220
- SKSE mod event names
183221

184222
## **Changelog**
223+
Version 2.x.x - 2016/MM/DD:
224+
225+
**Core**
226+
- Added new settings for toggling tooltips and customizing the looks of tooltips.
227+
- Added a setting to toggle function/event parameters in function/event call completions.
228+
229+
**Skyrim**
230+
- Added an optional tooltip that shows the name of the function/event and its parameters when typing inside of a function/event call (Sublime Text 3 build 3070 or newer only).
231+
- Linter
232+
- Fixed validation of explicit casting.
233+
- Fixed argument validation in function calls.
234+
- Added restrictions imposed on functions by the 'Global' keyword to the semantic analysis.
235+
- Added a warning when no import paths are passed to the semantic analysis (e.g. if no paths have been defined in the settings).
236+
- Code completion
237+
- Updated completions for functions/events in states.
238+
- Added completions for parameters of the function/event that is being called.
239+
- Added back completions for inherited functions/events that had been missing since the previous version.
240+
185241
Version 2.0.0 - 2016/04/16:
186242

187243
**Core**
@@ -193,38 +249,38 @@ Version 2.0.0 - 2016/04/16:
193249
**Skyrim**
194250
- Added a command to manually clear the various caches relevant to the linter and code completion without needing to restart Sublime Text. It is useful when modifying the contents of the *import* setting in the user settings or one of the folders specified in that setting.
195251
- Linter
196-
- Switched from using filenames to using a view's buffer ID for identification purposes. Scripts no longer have to have been saved to a file for the linter, and subsequently the code completion, to work.
197-
- Switched to using the unmodified lexical and syntactic analysis classes in semantic analysis when processing other scripts in order to get their properties, functions, and events.
198-
- Changed the way that lexical and syntactic analysis are performed in an effort to catch syntactic errors earlier.
199-
- Semantic analysis has been modified to no longer discard statements after use and instead store them in an object, which represents the script and can be used by the code completion system.
200-
- NodeVisitor now returns an object with *type*, *array*, and *object* fields instead of just a string.
201-
- Error messages in the status bar are now persistent until they have been resolved.
202-
- Removed gutter icon from highlighted lines.
203-
- Errors are no longer centered multiple times unless either the line with the error has moved up or down more than specified in the user settings (default: 2 lines) or there has been a linter pass without errors.
204-
- Modified error messages.
205-
- Fixed *GetPath* so that it works in a Unix environment where many file systems are case-sensitive.
206-
- Fixed a bug that caused issues when using identifiers starting with 'true' and 'false'.
207-
- Fixed NodeVisitor so that it returns the correct values from binary operator nodes involving comparison or logical operators.
208-
- Fixed a bug that caused non-global functions from imported scripts to be taken into account when checking for ambiguous function calls.
209-
- Fixed a bug that stopped casting 'self' to a type that extends the current script.
210-
- Fixed a bug that prevented the use of 'self' as an argument in function calls when the parameter type is the same as the current script.
211-
- Added specific warnings when declaring a variable/property with an identifier that is already in use in a property declaration in a parent script.
212-
- Added support for distinguishing between attempts to call global and non-global functions.
213-
- Added errors when attempting to use the *Self* or *Parent* variables in functions with the *Global* keyword.
214-
- Added validation of function return types.
215-
- Added more specific exceptions (e.g. when expecting a type, a literal, a keyword, or an identifier).
216-
- Added an error about casting to non-existing types.
217-
- Added an error when attempting to cast an expression that does not return a value.
218-
- Added errors when attempting to explicitly cast outside of the chain of inheritance of the type that the left-hand side expression evaluates to.
219-
- Added an error when attempting to access properties, functions, or events of expressions that evaluate to a base type or nothing.
220-
- Added an error when a variable's, property's, or parameter's name is the same as a known type.
221-
- Added an error when attempting to assign a non-array value to an array.
222-
- Added an error when attempting to use a type as if it were a variable (e.g. accessing a property directly via a type).
223-
- Added errors when attempting to incorrectly use arithmetic or logical operators.
252+
- Switched from using filenames to using a view's buffer ID for identification purposes. Scripts no longer have to have been saved to a file for the linter, and subsequently the code completion, to work.
253+
- Switched to using the unmodified lexical and syntactic analysis classes in semantic analysis when processing other scripts in order to get their properties, functions, and events.
254+
- Changed the way that lexical and syntactic analysis are performed in an effort to catch syntactic errors earlier.
255+
- Semantic analysis has been modified to no longer discard statements after use and instead store them in an object, which represents the script and can be used by the code completion system.
256+
- NodeVisitor now returns an object with *type*, *array*, and *object* fields instead of just a string.
257+
- Error messages in the status bar are now persistent until they have been resolved.
258+
- Removed gutter icon from highlighted lines.
259+
- Errors are no longer centered multiple times unless either the line with the error has moved up or down more than specified in the user settings (default: 2 lines) or there has been a linter pass without errors.
260+
- Modified error messages.
261+
- Fixed *GetPath* so that it works in a Unix environment where many file systems are case-sensitive.
262+
- Fixed a bug that caused issues when using identifiers starting with 'true' and 'false'.
263+
- Fixed NodeVisitor so that it returns the correct values from binary operator nodes involving comparison or logical operators.
264+
- Fixed a bug that caused non-global functions from imported scripts to be taken into account when checking for ambiguous function calls.
265+
- Fixed a bug that stopped casting 'self' to a type that extends the current script.
266+
- Fixed a bug that prevented the use of 'self' as an argument in function calls when the parameter type is the same as the current script.
267+
- Added specific warnings when declaring a variable/property with an identifier that is already in use in a property declaration in a parent script.
268+
- Added support for distinguishing between attempts to call global and non-global functions.
269+
- Added errors when attempting to use the *Self* or *Parent* variables in functions with the *Global* keyword.
270+
- Added validation of function return types.
271+
- Added more specific exceptions (e.g. when expecting a type, a literal, a keyword, or an identifier).
272+
- Added an error about casting to non-existing types.
273+
- Added an error when attempting to cast an expression that does not return a value.
274+
- Added errors when attempting to explicitly cast outside of the chain of inheritance of the type that the left-hand side expression evaluates to.
275+
- Added an error when attempting to access properties, functions, or events of expressions that evaluate to a base type or nothing.
276+
- Added an error when a variable's, property's, or parameter's name is the same as a known type.
277+
- Added an error when attempting to assign a non-array value to an array.
278+
- Added an error when attempting to use a type as if it were a variable (e.g. accessing a property directly via a type).
279+
- Added errors when attempting to incorrectly use arithmetic or logical operators.
224280
- Code completion
225-
- Performance has been improved by caching the result of the linter's semantic analysis.
226-
- More scenarios are now supported (e.g. keywords in script headers, variable declarations, property declarations, function/event declarations).
227-
- The source (the current script, the parent script, or another script) of the completion is specified.
281+
- Performance has been improved by caching the result of the linter's semantic analysis.
282+
- More scenarios are now supported (e.g. keywords in script headers, variable declarations, property declarations, function/event declarations).
283+
- The source (the current script, the parent script, or another script) of the completion is specified.
228284

229285
Version 1.0.7 - 2016/03/10:
230286
- Fixed a bug in the 'Generate completions' command.

0 commit comments

Comments
 (0)