Skip to content

Commit

Permalink
Remove GEB support (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaprieto authored Jul 23, 2024
1 parent 0bac5b1 commit 3837658
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 346 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Use <kbd>Ctrl</kbd>+<kbd>P</kbd> to open the Command Palette and type `Juvix`. A
| :-------- | :------------------------------------------: |
| typecheck | <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> |
| compile | <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd> |
| run | <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>X</kbd> |
| eval | <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>X</kbd> |
| doctor | <kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd> |

## Configuration
Expand Down Expand Up @@ -105,7 +105,6 @@ Make sure to reload the window if prompted for some changes to take effect.
- Intermediate Representations (IR) support:
- **JuvixCore**: syntax highlighting, REPL, execution.
- **JuvixAsm**: syntax highlighting.
- **JuvixGeb**: syntax highlighting, REPL, execution.
- **User Configuration Options**, some requiring a window reload.
- **Unicode input support** via `czhang03.unicode-math-input` extension.

Expand Down
4 changes: 2 additions & 2 deletions checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- [x] typecheck (ctrl+c ctrl+l)
- [x] compile (ctrl+c ctrl+c)
- [x] run (ctrl+c ctrl+r)
- [x] eval (ctrl+c ctrl+r)
- [x] html
- [x] internal parse
- [x] internal scope
Expand All @@ -14,7 +14,7 @@
- Juvix submenu
- [x] typecheck
- [x] compile
- [x] run
- [x] eval

- **Problem matchers provider:**

Expand Down
20 changes: 0 additions & 20 deletions language-configuration-geb.json

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 6 additions & 89 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"onLanguage:JuvixAsm",
"onLanguage:JuvixCore",
"onLanguage:JuvixMarkdown",
"onLanguage:JuvixGeb",
"onCommand:juvix-mode.installJuvixBinary"
],
"extensionPack": [
Expand Down Expand Up @@ -383,17 +382,6 @@
"extensions": [
".jvc"
]
},
{
"id": "JuvixGeb",
"aliases": [
"JuvixGeb",
"geb"
],
"extensions": [
".geb"
],
"configuration": "./language-configuration-geb.json"
}
],
"grammars": [
Expand All @@ -420,11 +408,6 @@
"scopeName": "source.JuvixCore",
"path": "./syntaxes/JuvixCore.tmLanguage.json"
},
{
"language": "JuvixGeb",
"scopeName": "source.JuvixGeb",
"path": "./syntaxes/JuvixGeb.tmLanguage.json"
},
{
"language": "JuvixAsm",
"scopeName": "source.JuvixAsm",
Expand Down Expand Up @@ -515,7 +498,7 @@
"icon": "$(output)"
},
{
"command": "juvix-mode.run",
"command": "juvix-mode.eval",
"title": "Evaluate current file",
"category": "Juvix",
"when": "(editorLangId == Juvix || editorLangId == JuvixMarkdown) && editorTextFocus",
Expand Down Expand Up @@ -595,27 +578,6 @@
"category": "Juvix",
"when": "editorLangId == JuvixCore && editorTextFocus",
"icon": "$(output)"
},
{
"command": "juvix-mode.geb-eval",
"title": "Internal: evaluate current Geb file",
"category": "Juvix",
"when": "editorLangId == JuvixGeb && editorTextFocus",
"icon": "$(debug-start)"
},
{
"command": "juvix-mode.geb-compile",
"title": "Internal: compile current Geb file",
"category": "Juvix",
"when": "editorLangId == JuvixGeb && editorTextFocus",
"icon": "$(output)"
},
{
"command": "juvix-mode.geb-check",
"title": "Internal: typecheck current Geb file",
"category": "Juvix",
"when": "editorLangId == JuvixGeb && editorTextFocus",
"icon": "$(check)"
}
],
"keybindings": [
Expand All @@ -637,12 +599,12 @@
},
{
"key": "shift+alt+x",
"command": "juvix-mode.run",
"command": "juvix-mode.eval",
"when": "(editorLangId == Juvix || editorLangId == JuvixMarkdown) && editorTextFocus"
},
{
"command": "juvix-mode.loadFileRepl",
"when": "(editorLangId == Juvix || editorLangId == JuvixCore || editorLangId == JuvixGeb) && editorTextFocus"
"when": "(editorLangId == Juvix || editorLangId == JuvixCore) && editorTextFocus"
},
{
"key": "shift+alt+c",
Expand All @@ -653,23 +615,6 @@
"key": "shift+alt+x",
"command": "juvix-mode.core-eval",
"when": "editorLangId == JuvixCore && editorTextFocus"
},
{
"key": "shift+alt+x",
"command": "juvix-mode.geb-eval",
"when": "editorLangId == JuvixGeb && editorTextFocus"
},
{
"key": "shift+alt+t",
"command": "juvix-mode.geb-check",
"when": "editorLangId == JuvixGeb && editorTextFocus",
"icon": "$(debug-start)"
},
{
"key": "shift+alt+c",
"command": "juvix-mode.geb-compile",
"when": "editorLangId == JuvixGeb && editorTextFocus",
"icon": "$(debug-start)"
}
],
"submenus": [
Expand All @@ -682,7 +627,7 @@
"menus": {
"editor/title": [
{
"when": "juvix-mode:ready && (editorLangId == Juvix || editorLangId == JuvixMarkdown || editorLangId == JuvixCore || editorLangId == JuvixGeb)",
"when": "juvix-mode:ready && (editorLangId == Juvix || editorLangId == JuvixMarkdown || editorLangId == JuvixCore)",
"command": "juvix-mode.loadFileRepl",
"group": "navigation@0"
},
Expand All @@ -698,7 +643,7 @@
},
{
"when": "juvix-mode:ready && (editorLangId == Juvix || editorLangId == JuvixMarkdown)",
"command": "juvix-mode.run",
"command": "juvix-mode.eval",
"group": "navigation@3"
},
{
Expand All @@ -715,21 +660,6 @@
"when": "juvix-mode:ready && editorLangId == JuvixCore",
"command": "juvix-mode.core-eval",
"group": "navigation@3"
},
{
"when": "juvix-mode:ready && editorLangId == JuvixGeb",
"command": "juvix-mode.geb-check",
"group": "navigation@1"
},
{
"when": "juvix-mode:ready && editorLangId == JuvixGeb",
"command": "juvix-mode.geb-compile",
"group": "navigation@2"
},
{
"when": "juvix-mode:ready && editorLangId == JuvixGeb",
"command": "juvix-mode.geb-eval",
"group": "navigation@3"
}
],
"editor/context": [
Expand All @@ -749,7 +679,7 @@
"group": "navigation"
},
{
"command": "juvix-mode.run",
"command": "juvix-mode.eval",
"group": "navigation"
},
{
Expand Down Expand Up @@ -797,18 +727,6 @@
"scope": "machine-overridable",
"description": "Absolute root path where the Juvix binary is located (e.g. /usr/local/bin/)"
},
"juvix-mode.gebBinName": {
"type": "string",
"default": "geb.image",
"scope": "machine-overridable",
"description": "Name of the executable of geb. (e.g. geb)"
},
"juvix-mode.gebBinPath": {
"type": "string",
"default": "",
"scope": "machine-overridable",
"description": "Absolute path to the Geb executable. (e.g. /usr/local/bin/)"
},
"juvix-mode.typecheckOn": {
"type": "string",
"default": "none",
Expand All @@ -830,7 +748,6 @@
"enum": [
"anoma",
"cairo",
"geb",
"wasi",
"native",
"risc0-rust"
Expand Down
2 changes: 1 addition & 1 deletion src/codelens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ package : Package :=
const moduleName: string | undefined = getModuleName(document);
const moduleDeclaration = `module ${moduleName};`;

let insertPosition: vscode.Position = new vscode.Position(0, 0);
const insertPosition: vscode.Position = new vscode.Position(0, 0);
let juvixBlockText: string = '';

if (moduleName && text.length === 0) {
Expand Down
17 changes: 2 additions & 15 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,6 @@ export class JuvixConfig {
return compilationFlags;
}

// Geb configuration methods
public gebBinaryName(): string {
return this.workspaceConfig.get('gebName', 'geb.image');
}

public gebBinaryPath(): string {
return this.workspaceConfig.get('gebBinPath', '');
}

public getGebExec(): string {
return path.join(this.gebBinaryPath(), this.gebBinaryName());
}

// Other configuration methods
public noColors(): boolean {
return this.workspaceConfig.get('noColors', false);
Expand Down Expand Up @@ -171,7 +158,7 @@ export class JuvixConfig {
}

public getGlobalFlags(): string {
let flags: string[] = [];
const flags: string[] = [];
if (this.noColors()) flags.push('--no-colors');
if (this.showNameIds()) flags.push('--show-name-ids');
if (this.onlyErrors()) flags.push('--only-errors');
Expand Down Expand Up @@ -257,4 +244,4 @@ export interface TaggedList {
[abbrev: string]: string;
}

export let config = new JuvixConfig();
export const config = new JuvixConfig();
38 changes: 0 additions & 38 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,4 @@ export function activate(_context: vscode.ExtensionContext) {
}
},
});

vscode.languages.registerDocumentFormattingEditProvider('JuvixGeb', {
provideDocumentFormattingEdits(
document: vscode.TextDocument,
): vscode.TextEdit[] {
const range = new vscode.Range(
document.positionAt(0),
document.positionAt(document.getText().length),
);

const filePath = document.uri.fsPath;
const formatterCall = [
config.getJuvixExec(),
config.getGlobalFlags(),
'--stdin',
'dev',
'geb',
'read',
filePath,
].join(' ');

const { spawnSync } = require('child_process');
const ls = spawnSync(formatterCall, {
shell: true,
input: document.getText(),
encoding: 'utf8',
});

if (ls.status == 0) {
const stdout = ls.stdout;
return [vscode.TextEdit.replace(range, stdout)];
} else {
const errMsg: string = ls.stderr.toString();
logger.error(errMsg, 'formatter.ts');
}
return [];
},
});
}
11 changes: 1 addition & 10 deletions src/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import * as vscode from 'vscode';
import { JuvixConfig } from './config';
import { observable } from 'mobx';
import * as path from 'path';
import {
canRunRepl,
isJuvixCoreFile,
isJuvixFile,
isJuvixGebFile,
} from './utils/base';
import { canRunRepl, isJuvixCoreFile, isJuvixFile } from './utils/base';

export const terminalName = 'Juvix REPL';

Expand Down Expand Up @@ -92,8 +87,6 @@ export class JuvixRepl {
shellCmd += ' ' + 'repl';
} else if (isJuvixCoreFile(this.document)) {
shellCmd += ' ' + 'dev core repl';
} else if (isJuvixGebFile(this.document)) {
shellCmd += ' ' + 'dev geb repl';
} else {
logger.warn('Unknown language', 'repl.ts');
return;
Expand All @@ -120,8 +113,6 @@ export class JuvixRepl {
else this.terminal.sendText(`\n:reload ${filename}`);
} else if (isJuvixCoreFile(this.document)) {
this.terminal.sendText(`:l ${filename}`);
} else if (isJuvixGebFile(this.document)) {
this.terminal.sendText(`:l ${filename}`);
} else return;
this.reloadNextTime = true;
this.show();
Expand Down
Loading

0 comments on commit 3837658

Please sign in to comment.