Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Width as a keyword #101

Merged
merged 1 commit into from
Dec 1, 2023
Merged

Remove Width as a keyword #101

merged 1 commit into from
Dec 1, 2023

Conversation

DecimalTurn
Copy link
Contributor

@DecimalTurn DecimalTurn commented Dec 1, 2023

I wanted to double check that all the IO keywords that were introduced were reserved keywords and could not be confused with variables.

Turns out it's the case for all of them except Width:

image

Then, I went and looked at the documentation and noticed that the Width statement is not a real statement, it's more of Sub and the VBA object explorer confirms this:

image

I would then suggest to remove it from the list as it's not even highlighted in the VBE itself.

Related issue: #96

Copy link
Owner

@serkonda7 serkonda7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough review of the changes. I will publish a new release in a few hours.

@serkonda7 serkonda7 merged commit db41910 into serkonda7:main Dec 1, 2023
4 checks passed
@DecimalTurn
Copy link
Contributor Author

DecimalTurn commented Dec 1, 2023

No, worries. I should have made that check before posting the list of statements, but the docs is misleading in that regard.

@DecimalTurn DecimalTurn deleted the patch-2 branch December 1, 2023 16:29
@serkonda7
Copy link
Owner

Agreed. MS docs should be more clear. I have checked the docs for every keyword you added too and did not spot width being special.

@serkonda7
Copy link
Owner

In the future, we might use the list of keywords in the docs: https://learn.microsoft.com/en-us/office/vba/language/reference/keywords-visual-basic-for-applications

However I haven't checked whether it is complete.

@h8nor
Copy link
Contributor

h8nor commented Jan 12, 2024

The keyword Any is also not true for type of data.

match: (?i)\b(Any|Byte|Boolean|Currency|Collection|Date|Double|Integer|Long(Long|Ptr)?|Object|Single|String|Variant)\b

Declare PtrSafe Sub First Lib "MyLib" (ByRef a As Any)

vscode-vba/CHANGELOG.md

Lines 67 to 73 in b142af1

## 0.8.0
_02 November 2022_
**Additions**
- Syntax highlighting for the WinWrap Basic language
- Highlight vba keywords `Eqv`, `Imp`, `TypeOf`, `AddressOf`, `WithEvents`, `Event`, `RaiseEvent`,
`Erase` and `Any`

@DecimalTurn
Copy link
Contributor Author

@h8nor While it is true that we can't create a variable directly in VBA with the type Any, it can still be used to define functions that are referencing external DLLs.

For example, this is valid VBA syntax:

Private Declare PtrSafe Function SendMessageA Lib "user32" (ByVal hWnd As LongPtr, ByVal wMsg As Long, _
                                                                ByVal wParam As LongPtr, lParam As Any) As LongPtr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants