[grammar] update
This commit is contained in:
@@ -8,6 +8,7 @@ A simple language server for Brainfuck based on the example.
|
|||||||
- [X] Syntax
|
- [X] Syntax
|
||||||
- [X] Bracket matching
|
- [X] Bracket matching
|
||||||
- [X] Autocomplete suggestions
|
- [X] Autocomplete suggestions
|
||||||
|
- [ ] Extension icon
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
## Structure
|
## Structure
|
||||||
|
@@ -4,15 +4,15 @@
|
|||||||
"blockComment":["/*","*/"]
|
"blockComment":["/*","*/"]
|
||||||
},
|
},
|
||||||
"brackets":[
|
"brackets":[
|
||||||
["(",")"]
|
["[","]"]
|
||||||
],
|
],
|
||||||
"autoClosingPairs":[
|
"autoClosingPairs":[
|
||||||
["(",")"]
|
["[","]"]
|
||||||
],
|
],
|
||||||
"surroundingPairs":[
|
"surroundingPairs":[
|
||||||
["(",")"]
|
["[","]"]
|
||||||
],
|
],
|
||||||
"folding": {
|
"_folding": {
|
||||||
"markers": {
|
"markers": {
|
||||||
"start": "^\\s*(//)|(--)\\s*#?region\\b",
|
"start": "^\\s*(//)|(--)\\s*#?region\\b",
|
||||||
"end": "^\\s*(//)|(--)\\s*#?endregion\\b"
|
"end": "^\\s*(//)|(--)\\s*#?endregion\\b"
|
||||||
|
@@ -39,11 +39,7 @@ export function activate(context: ExtensionContext) {
|
|||||||
// Options to control the language client
|
// Options to control the language client
|
||||||
let clientOptions: LanguageClientOptions = {
|
let clientOptions: LanguageClientOptions = {
|
||||||
// Register the server for plain text documents
|
// Register the server for plain text documents
|
||||||
documentSelector: [{ scheme: 'file', language: 'bf' }],
|
documentSelector: [{ scheme: 'file', language: 'bf' }]
|
||||||
synchronize: {
|
|
||||||
// Notify the server about file changes to '.clientrc files contained in the workspace
|
|
||||||
fileEvents: workspace.createFileSystemWatcher('**/.clientrc')
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,9 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"categories": [],
|
"categories": [],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"multi-root ready"
|
"multi-root ready",
|
||||||
|
"brainfuck",
|
||||||
|
"branflakes"
|
||||||
],
|
],
|
||||||
"prettier":{
|
"prettier":{
|
||||||
"tabWidth": 4,
|
"tabWidth": 4,
|
||||||
|
@@ -151,10 +151,10 @@ const validateBrackets = (text: string) => {
|
|||||||
let count = 0, lp: number[] = [],issues:number[]=[];
|
let count = 0, lp: number[] = [],issues:number[]=[];
|
||||||
const textsplit = text.split(``);
|
const textsplit = text.split(``);
|
||||||
textsplit.forEach((x, i) => {
|
textsplit.forEach((x, i) => {
|
||||||
if (x == '(' || x == ')') {
|
if (x == '[' || x == ']') {
|
||||||
|
|
||||||
if (x == '(') lp.push(i);
|
if (x == '[') lp.push(i);
|
||||||
if (x == ')') {if(lp.length==0) issues.push(i);lp.pop();}
|
if (x == ']') {if(lp.length==0) issues.push(i);lp.pop();}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
|
|||||||
end: textDocument.positionAt(e+1),
|
end: textDocument.positionAt(e+1),
|
||||||
},
|
},
|
||||||
severity:DiagnosticSeverity.Error,
|
severity:DiagnosticSeverity.Error,
|
||||||
code:'( and )',
|
code:'[ and ]',
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// diagnostics.push({
|
// diagnostics.push({
|
||||||
@@ -207,11 +207,6 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
|
|||||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
|
||||||
}
|
}
|
||||||
|
|
||||||
connection.onDidChangeWatchedFiles(_change => {
|
|
||||||
// Monitored files have change in VSCode
|
|
||||||
connection.console.log('We received an file change event');
|
|
||||||
});
|
|
||||||
|
|
||||||
// This handler provides the initial list of the completion items.
|
// This handler provides the initial list of the completion items.
|
||||||
connection.onCompletion(
|
connection.onCompletion(
|
||||||
(_textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
|
(_textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
|
||||||
@@ -254,22 +249,6 @@ connection.onCompletion(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//TODOF Implement further
|
|
||||||
// This handler resolves additional information for the item selected in
|
|
||||||
// the completion list.
|
|
||||||
// connection.onCompletionResolve(
|
|
||||||
// (item: CompletionItem): CompletionItem => {
|
|
||||||
// if (item.data === 1) {
|
|
||||||
// item.detail = 'Addition';
|
|
||||||
// item.documentation = 'Add 1 to the cell';
|
|
||||||
|
|
||||||
// } else if (item.data === 2) {
|
|
||||||
// item.detail = 'Subtraction';
|
|
||||||
// item.documentation = 'Subtract 1 from the cell';
|
|
||||||
// }
|
|
||||||
// return item;
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// Make the text document manager listen on the connection
|
// Make the text document manager listen on the connection
|
||||||
// for open, change and close text document events
|
// for open, change and close text document events
|
||||||
|
@@ -51,8 +51,8 @@
|
|||||||
"name":"keyword.operator.output"
|
"name":"keyword.operator.output"
|
||||||
},
|
},
|
||||||
"paren-expression": {
|
"paren-expression": {
|
||||||
"begin": "\\(",
|
"begin": "\\[",
|
||||||
"end": "\\)",
|
"end": "\\]",
|
||||||
"beginCaptures": {
|
"beginCaptures": {
|
||||||
"0": {
|
"0": {
|
||||||
"name": "punctuation.paren.open"
|
"name": "punctuation.paren.open"
|
||||||
|
Reference in New Issue
Block a user