-
Notifications
You must be signed in to change notification settings - Fork 5
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
Intellisense updates #941
Intellisense updates #941
Conversation
Created package json and language config for gaia vscode extension. Added Syntax Highlighting for comments, control keywords (if, for, using, etc), and strings. Started syntax highlighting for gaia keywords (ruleset, on_xxxx).
Here are the following changes in the package.json: - Updated all instances of "Gaia" to "GaiaPlatform" - Embedded C++ rules to gain access to its highlighting
Fixed comments to make them standardized with a single line per sentence and proper capitalization
Added C++ highlighting by making a source reference after embedding C++ in the package.json
Created a new GaiaPlatform.tmLanguage.json, no longer need this file
I split the extension into two different languages with their own highlighting and configuration settings to support both .ddl and .ruleset file types. I added `.ddl` language settings and renamed the current language from `GaiaPlatform` to `ruleset` for readability.
Rather than embedding `sql` into our language as I did with `cpp`, I had to pull the official Microsoft textmate file to edit and update the syntax directly (MIT licensed). I added and deleted some keywords. I deleted keywords that were commonly used as names for rows (i.e name) and added keywords that referenced data types that Microsoft did not already include in their file (i.e bool, uint64, etc) to highlight the data types of each row when creating new tables. Still needs semantic highlighting to highlight table names when defining relationships.
Since I split the extension into two separated languages, I had to make two separate language configuration json files for .ddl and .ruleset files. I made a new directory to house the files for modularity. The change between the two files lies in the comments where .ddl files can use '--' single line comments to represent sql syntax and .ruleset files can use '//' as single line comments to represent C++.
Add Keywords: references, uint32 Removed Keywords: type
Created hovers for gaia syntax using vscode hover provider
on_insert: "Reacts to the insertion of a new row.", | ||
on_change: "Reacts to the insertion or change of a row that contains the specified fields in the specified table.", | ||
connect: "Connect links rows between two tables based on an existing relationship between the tables. \n \n[Identifier].field_name1.connect(Table_name2) \n \nThe identifier can be either a table name or a tag. \n \nTable_name 1.connect(Table_name2). \n \nYou can use connect()/disconnect() directly on tables if there is only one relationship between the two tables. Otherwise, you need to use the link name as defined in the DDL.", | ||
disconnect: "Disconnect unlinks the rows. \n \nDisconnecting a one to many relationship: [identifier].link_name.disconnect(row). \n \nDisconnecting a one to one relationship: [identifier].link_name.disconnect()", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about when do you put spaces around an \n
and when you don't. What is the rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insert: "Inserts a row into a table.\n[Table_name].Insert(field_1: value_1, ..., field_n: value_n)\n Table_name: a table in the Catalog. \n Name Map: a series of entries in the form FieldName: FieldValue. \n*Note: Omitting a parameter will result in a default value of empty or 0. \nThe insert statement only allows inserting into primitive types.", | ||
remove: "Removes one or more rows from a table. \n \n[Table_Name].remove(): Removes the current row based on the anchor and the reference, \n \non_update(p:passenger) \n \n{ \n p.remove(); \n} \n \nNote: Attempting to remove a row that is currently connected will result in an error. Call disconnect() first and then remove the row.", | ||
//declarative looping | ||
if: "The if statement has the following form: \n[label:] \nif (condition) \n{ \n [continue [label]]; \n [break [label]]; \n} \n[else if (condition) \n{ \n [continue [label]]; \n [break [label]]; \n}] \n[else \n{ \n [continue [label]]; \n [break [label]]; \n}] \n[nomatch] // matches else if \n{ \n} \n[[nomatch] // matches if \n{ \n}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see descriptions for these that match the form used elsewhere. I.e. something like this for "if": "Allows you to conditionally execute a block of code. Full syntax: ...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for "nomatch": "Indicates ..."
}, | ||
"scripts": { | ||
"vscode:prepublish": "npm run compile", | ||
"compile": "tsc -b", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indentation.
"body": ["name string,", "$0"], | ||
"description": "snippet for name" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EOL at EOF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,202 @@ | |||
{ | |||
"#inc": { | |||
"prefix": "#inc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is indentation not 4 spaces in this file? Shouldn't all JSON files be formatted the same way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why but all of my spacing got messed up when I was editing my settings.json, I went back and converted each file now and deleted the snippets that I didn't want to include. I think I messed it up when I was transitioning into using a branch off of the original repo instead of my fork. Should be fixed now though, just pushed up the changes.
}, | ||
|
||
"using": { | ||
"prefix": "using", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,9 @@ | |||
{ | |||
"typescript.tsc.autoDetect": "off", | |||
"typescript.preferences.quoteStyle": "single", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad line indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
function activate(context: ExtensionContext) { | ||
|
||
//Creates map out of hover_info keys/values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing these! Don't forget the space after the //
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
//Creates map out of hover_info keys/values. | ||
const hover_info_map = new Map(Object.entries(hover_info)) | ||
|
||
//Creates provider to give the extension hover functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are comments not indented the same way as the following code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to see all JSON files consistently formatted. I'm not sure about the hover messages, but you can check those with @vDonGlover . LGTM otherwise.
TransportKind | ||
} from 'vscode-languageclient/node'; | ||
|
||
let client: LanguageClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the client
variable declared here but never used throughout this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some wording suggestions.
Code snippets for ddl and ruleset files
tsconfigs for building the extension language client
created a package.json for client dependencies
keyword fixes in ddl highlighting configuration