-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support abell regions with auto-completion
- Loading branch information
1 parent
5477cd5
commit 0336feb
Showing
12 changed files
with
169 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"languageServerExample.trace.server": "verbose" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Contribution Guide | ||
|
||
## Running Snippets and Syntax Highlighting | ||
|
||
- Open the repository in VSCode | ||
- Press `CTRL + F5` | ||
|
||
This should open a new extension host. You can open `.abell` file in it to see syntax highlighting. | ||
|
||
|
||
## Running Language Server in Watch Mode | ||
|
||
- Run `npm run watch` on root. | ||
- Go to Debug section and run `Extension` | ||
- In debug section, run `Attach Debugger` | ||
|
||
You can now make changes to Language Server and check in the extension host. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** helper */ | ||
|
||
export const execRegexOnAll = (regex:RegExp, template:string) => { | ||
/** allMatches holds all the results of RegExp.exec() */ | ||
const allMatches = []; | ||
let match:any = regex.exec(template); | ||
if (!match) { | ||
return { matches: [], input: template }; | ||
} | ||
|
||
const { input } = match; | ||
|
||
while (match !== null) { | ||
delete match.input; | ||
allMatches.push(match); | ||
match = regex.exec(template); | ||
} | ||
|
||
return { matches: allMatches, input }; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { CompletionItemKind, TextDocument } from "vscode-languageserver" | ||
import { Position } from "vscode-languageserver-textdocument" | ||
|
||
export function getAbellMode() { | ||
return { | ||
getId() { | ||
return 'abell' | ||
}, | ||
doComplete(document: TextDocument, position: Position) { | ||
const isAbellComponent = document.getText().trim().startsWith('<AbellComponent'); | ||
|
||
const abellCompletions = [ | ||
{ | ||
label: 'Abell', | ||
kind: CompletionItemKind.Variable, | ||
documentation: 'Main Abell variable that exports all necessary data' | ||
}, | ||
{ | ||
label: 'contentArray', | ||
kind: CompletionItemKind.Variable, | ||
documentation: 'Returns Array of meta values of all content' | ||
}, | ||
{ | ||
label: 'contentObj', | ||
kind: CompletionItemKind.Variable, | ||
documentation: 'Returns Object of meta values of all content' | ||
}, | ||
{ | ||
label: 'globalMeta', | ||
kind: CompletionItemKind.Variable, | ||
documentation: 'Contains all meta values from abell.config.js file' | ||
}, | ||
{ | ||
label: 'importContent', | ||
kind: CompletionItemKind.Function, | ||
documentation: 'Import markdown file from content directory. \n\nAbell.importContent(\'./hello-world/index.md\')' | ||
} | ||
] | ||
|
||
if (!isAbellComponent) { | ||
return abellCompletions; | ||
} | ||
|
||
return [] | ||
}, | ||
onDocumentRemoved(_document: TextDocument) {}, | ||
dispose() {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CompletionItemKind, TextDocument } from "vscode-languageserver" | ||
import { Position } from "vscode-languageserver-textdocument" | ||
|
||
export function getJSMode() { | ||
return { | ||
getId() { | ||
return 'javascript' | ||
}, | ||
doComplete(document: TextDocument, position: Position) { | ||
const isAbellComponent = document.getText().trim().startsWith('<AbellComponent'); | ||
if (!isAbellComponent) { | ||
return []; | ||
} | ||
|
||
return [ | ||
{ | ||
label: 'scopedSelector', | ||
documentation: 'Like document.querySelector but selects element ensuring it is from the same component', | ||
kind: CompletionItemKind.Function | ||
}, | ||
{ | ||
label: 'scopedSelectorAll', | ||
documentation: 'Like document.querySelectorAll but selects element ensuring it is from the same component', | ||
kind: CompletionItemKind.Function | ||
} | ||
] | ||
}, | ||
onDocumentRemoved(_document: TextDocument) {}, | ||
dispose() {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters