Skip to content

Commit

Permalink
Mark ambiguous float / long as deprecated
Browse files Browse the repository at this point in the history
Microsoft themselves warn against using that kind of notation.
Tests changed to reflect the new designation.
  • Loading branch information
matteocoder committed Jan 8, 2025
1 parent 11aecf6 commit 8edec81
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
18 changes: 18 additions & 0 deletions PowerShell.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,24 @@ contexts:
2: punctuation.definition.numeric.base.powershell
3: storage.type.numeric.powershell
4: keyword.other.unit.powershell
- match: |-
(?x:
(
\b{{dec_digits}}
(?:
(?:
(?:(?:\.(?!\.))\d*) # No `_` after the `.`
{{dec_exponent}}?
| {{dec_exponent}}
)
(?:{{integer_suffix}})
)
)
({{bytes_unit}}\b)?
)
captures:
1: invalid.deprecated.powershell
2: keyword.other.unit.powershell
- match: |-
(?x:
(
Expand Down
10 changes: 8 additions & 2 deletions Tests/syntax_test_PowerShell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,14 @@ There is no @platting here!
1.d
# ^^^ constant.numeric.float
1.lGB
# ^^^ constant.numeric.float - unclear whether float or int
# ^^^ invalid.deprecated
# ^^ keyword.other.unit
1.2345e1LGB
# ^^^^^^^^^ invalid.deprecated
# ^^ keyword.other.unit
1.2345e-5LGB
# ^^^^^^^^^^ invalid.deprecated
# ^^ keyword.other.unit
1.dGB
# ^^^ constant.numeric.float
# ^^ keyword.other.unit
Expand Down Expand Up @@ -524,7 +530,7 @@ There is no @platting here!
# ^ keyword.operator
-10.002L
# ^ keyword.operator.unary
# ^^^^^^^ constant.numeric.float - unclear whether float or int
# ^^^^^^^ invalid.deprecated
$x..5.40D
# ^ punctuation.definition.variable
# ^^ variable.other.readwrite
Expand Down

0 comments on commit 8edec81

Please sign in to comment.