-
Notifications
You must be signed in to change notification settings - Fork 16
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
[FEATURE] Linter Context for MV Subroutines and Functions #113
Comments
Brent, this seems like an excellent candidate for "User Snippets". I have the following in mine, as well as common things like OPEN, READ, WRITE, defined the way I like them. When I type SUB, hit Ctrl-Space for complete, and choose the SUB snippet, I can tab through the various completions to fill in $1, $2, etc in the snippet body.
|
Ian, I think that under your PROGRAM snippet, the “Created” line is missing “, at the end.
From: Ian McGowan <[email protected]>
Reply-To: mvextensions/mvbasic <[email protected]>
Date: Tuesday, June 23, 2020 at 8:14 PM
To: mvextensions/mvbasic <[email protected]>
Cc: Subscribed <[email protected]>
Subject: Re: [mvextensions/mvbasic] [FEATURE] Linter Context for MV Subroutines and Functions (#113)
Brent, this seems like an excellent candidate for "User Snippets<https://code.visualstudio.com/docs/editor/userdefinedsnippets>". I have the following in mine, as well as common things like OPEN, READ, WRITE, defined the way I like them. When I type SUB, hit Ctrl-Space for complete, and choose the SUB snippet, I can tab through the various completions to fill in $1, $2, etc in the snippet body.
[Snippet]<https://user-images.githubusercontent.com/408975/85485245-2d134b00-b57d-11ea-9300-fc37b3220440.gif>
{
"SUBROUTINE Skeleton": {
"prefix": "SUB",
"body": [
"SUBROUTINE $1($2)",
"***************************************************************************",
"* Program: $1",
"* Author : Ian McGowan",
"* Created: ${3:$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE}",
"* Updated: $3",
"* Comment: $4",
"***************************************************************************",
"*",
"$0"
],
"description": "The UniBasic SUBROUTINE command determines the beginning of an external subroutine"
},
"PROGRAM Skeleton": {
"prefix": "PROG",
"body": [
"***************************************************************************",
"* Program: $1",
"* Author : Ian McGowan",
"* Created: ${2:$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE}
"* Updated: $2",
"* Comment: $3",
"***************************************************************************",
"*",
"$0"
],
"description": "The UniBasic PROGRAM command determines the beginning of a program"
},
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#113 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACOODL636W6ASVPKINZXXPLRYFHQHANCNFSM4OGAWHRQ>.
|
This is very cool. I think it's more for adding code blocks, I'm looking
for something different.
I'm looking for custom autocomplete and documentation tied to the MV Basic
linter.
If I start to type 'OPEN' the linter shows OPEN, displays an example, and
shows documentation for the open verb.
In my example, I want to add a commonly used custom function
`DateTimeFormat` to a program that I am writing.
If I accept the autocomplete, it should add the full text to my program,
this way I have a working example, that I might just need to update the
variables in:
DateTimeFormat(inDate,inTime,'format')
If I hover over `DateTimeFormat`, it should show the help text:
Format internal data and or time in custom external format
You must have INCLUDE BP CustomLibrary in any program that references this
function
inDate=date in internal format - can be null if you do not need to convert
date
inTime=time in internal format - can be null if you do not need to convert
time
format=string using any combination of the follow characters, undefined
characters will be used as literals
Since we drive VSCode from Accuterm and setup the environments based on the
MBBasic json, we can drive this to all developers from our server.
The snippets functionality would probably work for individual developers
that just want to autocomplete chunks of code.
*Brent Blair* <http://www.linkedin.com/in/BrentLBlair>
Vice President of IT
Encompass
Phone 954.474.0300
Fort Lauderdale, FL
<https://www.google.com/maps/place/Encompass+Parts+Distribution/@26.145357,-80.2482168,12.46z/data=!4m5!3m4!1s0x0:0xb2bfe23d3412449!8m2!3d26.0920996!4d-80.2409538>
[email protected]
encompass.com
…On Tue, Jun 23, 2020 at 9:14 PM Ian McGowan ***@***.***> wrote:
Brent, this seems like an excellent candidate for "User Snippets
<https://code.visualstudio.com/docs/editor/userdefinedsnippets>". I have
the following in mine, as well as common things like OPEN, READ, WRITE,
defined the way I like them. When I type SUB, hit Ctrl-Space for complete,
and choose the SUB snippet, I can tab through the various completions to
fill in $1, $2, etc in the snippet body.
[image: Snippet]
<https://user-images.githubusercontent.com/408975/85485245-2d134b00-b57d-11ea-9300-fc37b3220440.gif>
{
"SUBROUTINE Skeleton": {
"prefix": "SUB",
"body": [
"SUBROUTINE $1($2)",
"***************************************************************************",
"* Program: $1",
"* Author : Ian McGowan",
"* Created: ${3:$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE}",
"* Updated: $3",
"* Comment: $4",
"***************************************************************************",
"*",
"$0"
],
"description": "The UniBasic SUBROUTINE command determines the beginning of an external subroutine"
},
"PROGRAM Skeleton": {
"prefix": "PROG",
"body": [
"***************************************************************************",
"* Program: $1",
"* Author : Ian McGowan",
"* Created: ${2:$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE}
"* Updated: $2",
"* Comment: $3",
"***************************************************************************",
"*",
"$0"
],
"description": "The UniBasic PROGRAM command determines the beginning of a program"
},
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFRDR4MUA3GB7PZXUYPLAJTRYFHQHANCNFSM4OGAWHRQ>
.
|
To be technically correct (the best kind!) "Linting" is different from "Intellisense", both are managed in https://github.com/mvextensions/mvbasic/blob/master/server/src/server.ts, in loadIntelliSense and validateTextDocument functions. There is an option for a custom word list in server.ts/loadIntelliSense, but it's far from the "autocomplete" option you're looking for - if you specify a filename with a bunch of words in it, optionally wrapped in double quotes, it will color code those words. It's a good suggestion to have a "custom intellisense list" parameter that did something similar, where you provide your own syntax file (perhaps from a central file share as you suggested) and it gets merged with the system provided one. But absent that, you should be able to modify the appropriate Language.json file in the Syntaxes folder and add your own syntax definitions. Sadly that will be lost every time the extension updates though. The user snippet option does show some help when completing (and snippets autocomplete just like the built in intellisense), but it sounds like that's not centrally managed enough for your situation, plus it looks kinda sucky if you have a lot of description: |
@brentlblair here's how I would approach this:
{
"key": "$Include",
"icon": 14,
"index": 1,
"documentation": "The $INCLUDE or $INSERT directive inserts the program/code snippet specified into the current source code.\r\nIf the optional filename is specified the code is read from that file.",
"detail": "$INCLUDE programname\r\n$INCLUDE filename programname\r\n$INSERT programname\r\n$INSERT filename programname"
}
|
A PR would be great, against the If you could include relevant doc updates for this new feature that'd be excellent as well. Nice work!!! |
2.0.9 released! Closing issue. |
I know the linter has custom text for jBase VERBS that shows how to use the VERB. I would like to enhance this by being able to describe SOME frequently used Subroutines and Functions from my system possibly using the MVBasic settings file in json format.
Something like this could be added to the MVBasic settings:
The above code would auto complete the following in VS Code:
DateTimeFormat(inDate,inTime,'format')
It would also display the following hover / help text (I used a | to indicate a new line:
Please let me know if this makes sense of if you have any questions.
The text was updated successfully, but these errors were encountered: