Skip to content

Commit

Permalink
Merge pull request #6 from atomiechen/dev
Browse files Browse the repository at this point in the history
Bump version to 0.1.3
  • Loading branch information
atomiechen authored May 21, 2024
2 parents 20db434 + 2914304 commit 3a6f8ee
Show file tree
Hide file tree
Showing 14 changed files with 519 additions and 64 deletions.
60 changes: 58 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,62 @@ All notable changes to the "vscode-handyllm" extension will be documented in thi

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
## [0.1.3] - 2024-05-22

### Added

- Frontmatter background highlight
- Message boundaries highlight

### Changed

- Rename `keyword.role` to `markup.heading` for themes in the wild to bold this scope

### Removed

- Remove `#` line comment


## [0.1.2] - 2024-05-20

### Added

- Highlighting extra properties of messages
- Parse special typed blocks as YAML
- MIT License

### Removed

- Remove comment highlight to properly highlight completions prompt


## [0.1.1] - 2024-05-05

### Changed

- Update command category and title


## [0.1.0] - 2024-05-05

### Added

- Run hprompt command as menu action, context menu command or command palette command, with keybinding
- Configuration for handyllm command name
- Create hprompt command
- New files use a starter template
- Default turn on word wrap


## [0.0.1] - 2024-04-29

### Added

Basic syntax highlighting for hprompt files:
- Parse each content block as a markdown
- Support embedded languages in markdown
- Use `#` as single line comment
- Injection to highlight %...% variables
- No bracket color

Binary file modified demo/create.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/run.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion language-configuration.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "#"
// "lineComment": "#"
},
// symbols used as brackets
"brackets": [
Expand Down
29 changes: 27 additions & 2 deletions package-lock.json

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

78 changes: 71 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/atomiechen/vscode-handyllm"
},
"private": true,
"version": "0.1.2",
"version": "0.1.3",
"engines": {
"vscode": "^1.66.0"
},
Expand Down Expand Up @@ -89,7 +89,66 @@
"handyllm.commandName": {
"type": "string",
"default": "handyllm",
"description": "The command name of HandyLLM"
"description": "The command name of HandyLLM",
"order": 0
},
"handyllm.frontmatter.background.enabled": {
"type": "boolean",
"default": true,
"description": "Enable frontmatter background",
"order": 100
},
"handyllm.frontmatter.background.light": {
"type": "string",
"default": "#acacac36",
"description": "The background color of frontmatter in light theme",
"order": 101
},
"handyllm.frontmatter.background.dark": {
"type": "string",
"default": "#54545436",
"description": "The background color of frontmatter in dark theme",
"order": 102
},
"handyllm.message.boundary.enabled": {
"type": "boolean",
"default": true,
"description": "Enable message boundary",
"order": 200
},
"handyllm.message.boundary.style": {
"type": "string",
"enum": [
"dotted",
"dashed",
"solid",
"double",
"groove",
"ridge",
"inset",
"outset"
],
"default": "dotted",
"description": "The style of message boundary",
"order": 201
},
"handyllm.message.boundary.width": {
"type": "number",
"default": 1,
"description": "The width of message boundary",
"order": 202
},
"handyllm.message.boundary.light": {
"type": "string",
"default": "#acacac",
"description": "The color of message boundary in light theme",
"order": 203
},
"handyllm.message.boundary.dark": {
"type": "string",
"default": "#545454",
"description": "The color of message boundary in dark theme",
"order": 204
}
}
}
Expand Down Expand Up @@ -126,6 +185,7 @@
"path": "./syntaxes/hprompt.tmLanguage.json",
"embeddedLanguages": {
"meta.frontmatter.block": "yaml",
"meta.block.yaml": "yaml",
"source.js": "javascript",
"source.css": "css",
"meta.embedded.block.html": "html",
Expand Down Expand Up @@ -187,15 +247,19 @@
]
},
"devDependencies": {
"@vscode/vsce": "^2.26.0",
"@types/vscode": "^1.66.0",
"@types/lodash.debounce": "^4.0.9",
"@types/mocha": "^10.0.6",
"@types/node": "18.x",
"@types/vscode": "^1.66.0",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"eslint": "^8.57.0",
"typescript": "^5.4.5",
"@vscode/test-cli": "^0.0.8",
"@vscode/test-electron": "^2.3.9"
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.26.0",
"eslint": "^8.57.0",
"typescript": "^5.4.5"
},
"dependencies": {
"lodash.debounce": "^4.0.8"
}
}
15 changes: 15 additions & 0 deletions src/cmd_create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as vscode from 'vscode';


export function registerCommandCreate(context: vscode.ExtensionContext) {
let disposableCreateHprompt = vscode.commands.registerCommand('handyllm.createHprompt', function () {
vscode.workspace.openTextDocument({
content: '---\n# add YAML frontmatter data here\n\n---\n\n$system$\nYou are a helpful assistant.\n\n$user$\nPlace you instructions here.\n\n',
language: 'hprompt' // set the language mode to hprompt
}).then(document => {
vscode.window.showTextDocument(document);
});
});

context.subscriptions.push(disposableCreateHprompt);
}
47 changes: 47 additions & 0 deletions src/cmd_run.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as vscode from 'vscode';


function getOrCreateTerminal(name: string): vscode.Terminal {
// check if the terminal already exists
const existingTerminal = vscode.window.terminals.find(terminal => terminal.name === name);
if (existingTerminal) {
return existingTerminal;
} else {
return vscode.window.createTerminal(name);
}
}

export function registerCommandRun(context: vscode.ExtensionContext) {
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposableRunHprompt = vscode.commands.registerCommand('handyllm.runHprompt', (uri: vscode.Uri) => {
let filePath = undefined;
if (uri) {
filePath = uri.fsPath;
} else {
const activeEditor = vscode.window.activeTextEditor;
if (activeEditor) {
// get the file path of the currently active file
filePath = activeEditor.document.uri.fsPath;
}
}
if (filePath) {
// get handyllm command name from the settings
let handyllmCommand = vscode.workspace.getConfiguration().get('handyllm.commandName', 'handyllm').trim();
if (handyllmCommand === '') {
handyllmCommand = 'handyllm';
}
// get or create a terminal with the name "hprompt"
const terminal = getOrCreateTerminal("hprompt");
terminal.show(true);
// run the hprompt command in the terminal
terminal.sendText(`${handyllmCommand} hprompt ${filePath}`);
} else {
// Display a message box to the user
vscode.window.showErrorMessage('No active editor found!');
}
});

context.subscriptions.push(disposableRunHprompt);
}
Loading

0 comments on commit 3a6f8ee

Please sign in to comment.