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

Intellisense updates #941

Merged
merged 54 commits into from
Sep 27, 2021
Merged

Intellisense updates #941

merged 54 commits into from
Sep 27, 2021

Conversation

jc-gaiaplatform
Copy link

  1. Hover info updates:
  • converted hovers to markdown strings
  • converted hover_info.json to hover_info.js
  • created a map out of js object, now has a lookup instead of an iteration over the keys of the object
  1. Code snippets for ddl and ruleset files

  2. tsconfigs for building the extension language client

  3. created a package.json for client dependencies

  4. keyword fixes in ddl highlighting configuration

jc-gaiaplatform and others added 30 commits August 20, 2021 09:12
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()",
Copy link
Contributor

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?

Copy link
Author

@jc-gaiaplatform jc-gaiaplatform Sep 22, 2021

Choose a reason for hiding this comment

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

for markdown, a new line is created with 2 spaces followed by the \n. So if there are no spaces after the \n then that means I am starting the next sentence on that line. Spaces on both sides means I'm trying to create an extra space for readability.
image

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}",
Copy link
Contributor

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: ...".

Copy link
Contributor

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",
Copy link
Contributor

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"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

EOL at EOF.

Copy link
Author

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",
Copy link
Contributor

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?

Copy link
Author

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad indentation.

Copy link
Author

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad line indentation.

Copy link
Author

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.
Copy link
Contributor

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 //.

Copy link
Author

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.
Copy link
Contributor

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?

Copy link
Author

@jc-gaiaplatform jc-gaiaplatform Sep 22, 2021

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@LaurentiuCristofor LaurentiuCristofor left a 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;
Copy link
Contributor

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?

Copy link
Contributor

@phillipov phillipov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@vDonGlover vDonGlover left a 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.

@jc-gaiaplatform jc-gaiaplatform merged commit 5025c73 into master Sep 27, 2021
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.

6 participants