Skip to content

Commit

Permalink
minor updates P2 Hover
Browse files Browse the repository at this point in the history
- PRI methods want non-doc-comments vs doc-comments
- Add blank line before locals in PUB/PRI generated method comments
  • Loading branch information
ironsheep committed Jun 28, 2023
1 parent 7ccaaf6 commit 306ea06
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
11 changes: 9 additions & 2 deletions spin2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ Possible next additions:
- Add Signature popups for `PUB`, `PRI` and Spin2 method signatures (help text)
- Add Hover popups for pasm instructions (help text for each instruction)
- Update theme to work better with a couple common languages we use near our P2 projects (e.g., Python)
- Add light theme
- Add light theme
- Investigate and possibly add unique coloring for method pointers
- Add spin2 instruction templates as Snippets (_for instructions with two or more parameters_)
- Add new-file templates as Snippets
- Add additional Snippets as the community identifies them

## [1.9.4] 2023-06-27

Minor fixes to hover support for P2!

- PRI methods want non-doc-comments vs doc-comments
- Add blank line before locals in PUB/PRI generated method comments

## [1.9.3] 2023-06-27

Minor fixes to hover support for P2!
Expand All @@ -38,7 +45,7 @@ Add new hover support for P2!

- Now can hover over **User** variables, constants, methods, pasm labels and objects to display pop-up information about the item including comments within the code for the item
- Now supports hover for **Built-in Spin2** methods, variables, constants and smart-pin contstants to display pop-up documentation about the built-in item
- Adds new Doc-Comment Generation for PUB and PRI methods via keystroke [Ctrl+Alt+c] - Ctrl+Alt+( c )omment. <br>- Comment is inserted immediately below the PUB or PRI line.
- Adds new Doc-Comment Generation for PUB and PRI methods via keystroke [Ctrl+Alt+c] - Ctrl+Alt+( c )omment. <br>- Comment is inserted immediately below the PUB or PRI line.
- BUGFIX P2 no longer treats `asmclk` as pasm label (Oops)
- BUGFIX P2 in debug() statements: variables accessed as sub bitfields now highlighted correctly (e.g., c.[2..7])
- P2 syntax: added getcrc, strcopy
Expand Down
1 change: 0 additions & 1 deletion spin2/TEST/spin2/220415-fixes.spin2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CON { app constants }

PUB Main() | pwmSpecs, offset, encVal, priorEncVal


debug(`term term4 pos 128 540 size 30 8 textsize 16 color cyan)

debug(`term4 'p_gain=`(P_GAIN), MINms=`(MIN_MS_TO_MOV)') ' <--- "MINms=" shouldn't be RED
Expand Down
1 change: 1 addition & 0 deletions spin2/TEST/spin2/220808-fixes.spin2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ma_mtmp3 res 1
ma_mtmp1 res 1
ma_adpcm_bufferbase long @adpcm_buffers ' pointer to buffers

' address of buffer
adpcm_buffers
byte 0[2*7*16]

Expand Down
29 changes: 27 additions & 2 deletions spin2/TEST/spin2/_code_comment_demo.spin2
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,29 @@
'' Updated.... 26 Jun 2023
''
'' =================================================================================================
CON { comment position demo }

' preceeding comment
NEW_CONSTANT_1 = 5

NEW_CONSTANT_2 = 7 ' trailing comment

' Enum with values commented:
' ENUM_VAL_1 - we have 1 becase
' ENUM_VAL_2 - yes, we have 2 too
' ENUM_VAL_3 - we have yet anotehr readons for 3
#0, ENUM_VAL_1, ENUM_VAL_2, ENUM_VAL_3



CON { timing }

CLK_FREQ = 270_000_000 ' system freq as a constant
_clkfreq = CLK_FREQ ' set system clock

' here 2 = 3!
VAL2 = ENUM_VAL_3

CON { fixed io pins }

RX1 = 63 { I } ' Prop programming / debug
Expand Down Expand Up @@ -48,13 +66,20 @@ OBJ { included objects }

' use COG for s.bus serial input/decoding
sbus : "jm_sbus_rx"

'term : "isp_serial_singleton" ' debug terminal output
term : "isp_serial_singleton" ' debug terminal output

DAT

' DAT preceeding comment
sillyVar long 0 ' trailing but preceeding comment prefered
sillyVar2 long 0 ' DAT trailing comment


VAR

' VAR preceeding comment
LONG forDocExplan1
LONG forDocExplan2 ' VAR trailing comment

PUB null()
'' This is not a top-level object
Expand Down
2 changes: 1 addition & 1 deletion spin2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Spin2",
"description": "Spin2/Pasm2 Syntax/Semantic Highlighting w/Code Outline and Custom tabbing support",
"icon": "images/Propeller.ico",
"version": "1.9.3",
"version": "1.9.4",
"publisher": "IronSheepProductionsLLC",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion spin2/src/spin.semantic.findings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ export class DocumentFindings {
const bIsMethod: boolean = findings.token.type == "method";
const bIsPublic: boolean = findings.token.modifiers.includes("static") ? false : true;
if (bIsMethod) {
findings.declarationComment = this.blockCommentMDFromLine(findings.declarationLine + 1, eCommentFilter.docCommentOnly);
const commentType: eCommentFilter = bIsPublic ? eCommentFilter.docCommentOnly : eCommentFilter.nondocCommentOnly;
findings.declarationComment = this.blockCommentMDFromLine(findings.declarationLine + 1, commentType);
// if no block doc comment then we can substitute a preceeding or trailing doc comment for method
const canUseAlternateComment: boolean = bIsPublic == false || (bIsPublic == true && declInfo.isDocComment) ? true : false;
if (!findings.declarationComment && canUseAlternateComment) {
Expand Down
2 changes: 1 addition & 1 deletion spin2/src/spin2.semanticAndOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
const numberLocals: number = (localsString.match(/,/g) || []).length + 1;
const localsNames = localsString.split(/[ \t,]/).filter(Boolean);
this._logMessage(`* iDc localsString=[${localsString}], localsNames=[${localsNames}]`);
linesToInsert.push("'" + endOfLineStr); // blank line
linesToInsert.push("" + endOfLineStr); // empty line so following is not shown in comments for method
linesToInsert.push("' Local Variables:" + endOfLineStr); // blank line
for (let localIdx = 0; localIdx < numberLocals; localIdx++) {
linesToInsert.push("'" + ` @local ${localsNames[localIdx]} - ` + endOfLineStr); // blank line
Expand Down

0 comments on commit 306ea06

Please sign in to comment.