Skip to content

Commit

Permalink
Clarify developer setup and run the language server in fql` blocks in…
Browse files Browse the repository at this point in the history
… JS / TS (#37)

* Clarify developer setup

* WIP run LSP in embedded blocks

* Fix syntax highlighting for fql blocks

* Allow whitespace between fql and backtick

* Bump version

---------

Co-authored-by: Neil Macneale V <[email protected]>
  • Loading branch information
cleve-fauna and macmv authored May 8, 2024
1 parent cb4569b commit 6dae837
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ node_modules
# Logs
yarn-debug.log*
yarn-error.log*

# Emacs
*~
*#
18 changes: 15 additions & 3 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
## Developing the Extension
# Developing the Extension

Open vscode in this directory, and hit F5 to run a new version of
vscode, which will have this plugin running.
## Setup
Before launching you'll need to fetch the analzyer locally and compile this app:

```
yarn developer-setup
```


## Launching
Now to launch:

Open vscode in this directory, and select "Run -> Start Debugging" from the menu,
there is an `F5` shortcut for this on some systems with some keybindings. This will
launch a parallel instance of VS code with the local extension running.

Now in this new instance of vscode, press cmd+l/ctrl+l to open the FQL Playground.
This should have syntax highlighting, and a language server should give live
Expand Down
26 changes: 22 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"url": "https://github.com/fauna/fauna-vscode"
},
"publisher": "Fauna",
"version": "0.1.1",
"version": "0.2.0",
"engines": {
"vscode": "^1.72.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onLanguage:fql"
"onLanguage:fql",
"onLanguage:typescript"
],
"main": "./out/extension.js",
"dependencies": {
Expand All @@ -41,6 +42,7 @@
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"developer-setup": "yarn install && yarn compile && yarn download-analyzer",
"download-analyzer": "bash ./scripts/download-analyzer.sh",
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint && yarn run download-analyzer",
Expand All @@ -65,7 +67,7 @@
"fauna.dbSecret": {
"type": "string",
"default": "",
"description": "The secret to use to connnect to your fauna database.",
"description": "The secret used to connect to your fauna database.",
"scope": "window"
},
"fauna.endpoint": {
Expand Down Expand Up @@ -130,6 +132,22 @@
"language": "fsl",
"scopeName": "source.fsl",
"path": "./syntax/fsl.tmGrammar.json"
},
{
"injectTo": [
"source.js",
"source.jsx",
"source.ts",
"source.tsx",
"text.html.basic",
"text.html.derivative",
"text.html.markdown"
],
"scopeName": "meta.embedded.block.fql",
"path": "./syntax/fql.embedded.js.tmGrammar.json",
"embeddedLanguages": {
"meta.embedded.block.fql": "source.fql"
}
}
],
"keybindings": [
Expand Down Expand Up @@ -169,4 +187,4 @@
}
]
}
}
}
34 changes: 34 additions & 0 deletions syntax/fql.embedded.js.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"scopeName": "meta.embedded.block.fql",
"injectionSelector": "L:source",
"patterns": [
{
"include": "#fql-block"
}
],
"repository": {
"fql-block": {
"begin": "(fql)\\W*(`)",
"name": "meta.embedded.block.fql",
"end": "`",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.fql"
},
"1": {
"name": "punctuation.definition.string.begin.fql.backtick"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.fql"
}
},
"patterns": [
{
"include": "source.fql"
}
]
}
}
}

0 comments on commit 6dae837

Please sign in to comment.