Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target
node_modules/
.vscode-test
vscode-extension/out
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Client",
"args": ["--extensionDevelopmentPath=${workspaceRoot}/vscode-extension"],
"outFiles": ["${workspaceRoot}/vscode-extension/out/**/*.js"],
"preLaunchTask": {
"type": "npm",
"script": "watch",
"path": "vscode-extension"
}
}
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Place your settings in this file to overwrite default and user settings.
{
"biome.lspBin": "vscode-extension/node_modules/@biomejs/biome/bin/biome",
"editor.defaultFormatter": "biomejs.biome"
}
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
},
"path": "vscode-extension"
}
]
}
20 changes: 20 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"files": {
"ignore": ["vscode-extension/out/**/*", "node_modules"]
}
}
16 changes: 16 additions & 0 deletions cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct Args {
pub enum Subcommand {
Run(RunCommand),
Init(InitCommand),
List(ListCommand),
}

#[derive(FromArgs, PartialEq, Debug)]
Expand All @@ -34,6 +35,21 @@ pub struct RunCommand {
/// initialize a config of reminder-lint
pub struct InitCommand {}

#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "list")]
/// list reminder-lint comments
pub struct ListCommand {
/// path to the config file (default: ./remind.yml)
#[argh(option, short = 'c')]
pub config_file_path: Option<String>,
/// path to the ignore file (default: ./.remindignore)
#[argh(option, short = 'i')]
pub ignore_file_path: Option<String>,
/// output in json format
#[argh(switch)]
pub json: bool,
}

impl Args {
pub fn new() -> Self {
argh::from_env()
Expand Down
33 changes: 33 additions & 0 deletions cli/src/subcommand/list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use crate::args::ListCommand;
use anyhow::Error;
use reminder_lint_core::config::builder::ConfigBuilder;

pub fn execute_list(command: ListCommand) -> Result<(), Error> {
let conf = ConfigBuilder::new()
.config_file_path(command.config_file_path)
.ignore_file_path(command.ignore_file_path)
.build()?;

let reminders = reminder_lint_core::reminders(&conf)?;

if command.json {
println!("{}", serde_json::to_string(&reminders)?);
return Ok(());
}

for remind in &reminders.expired {
println!(
"{}:{} {}",
remind.position.file, remind.position.line, remind.message
);
}

for remind in &reminders.upcoming {
println!(
"{}:{} {}",
remind.position.file, remind.position.line, remind.message
);
}

Ok(())
}
4 changes: 3 additions & 1 deletion cli/src/subcommand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ use crate::{
print::{pretty_print, Status},
};

use self::{init::execute_init, run::execute_run};
use self::{init::execute_init, list::execute_list, run::execute_run};

mod init;
mod list;
mod run;

pub fn execute_subcommand(subcommand: Subcommand) {
let result = match subcommand {
Subcommand::Run(command) => execute_run(command),
Subcommand::Init(command) => execute_init(command),
Subcommand::List(command) => execute_list(command),
};

if let Err(e) = result {
Expand Down
3 changes: 2 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ pub mod remind;
use config::Config;
use error::ReminderLintError;
use remind::list_reminders;
use serde::Serialize;

#[derive(Debug)]
#[derive(Debug, Serialize)]
pub struct Reminders {
pub expired: Vec<remind::Remind>,
pub upcoming: Vec<remind::Remind>,
Expand Down
5 changes: 3 additions & 2 deletions core/src/remind/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ use grep_searcher::sinks::UTF8;
use grep_searcher::SearcherBuilder;
use ignore::WalkBuilder;
use meta::{convert_meta_regex, extract_placeholders};
use serde::Serialize;
use std::collections::HashMap;
use std::io;

use crate::config::Config;

mod meta;

#[derive(Debug)]
#[derive(Debug, Serialize)]
pub struct Remind {
pub datetime: i64,
pub message: String,
pub position: Position,
pub meta: HashMap<String, String>,
}

#[derive(Debug)]
#[derive(Debug, Serialize)]
pub struct Position {
pub file: String,
pub line: u64,
Expand Down
1 change: 1 addition & 0 deletions vscode-extension/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
9 changes: 9 additions & 0 deletions vscode-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/.vscode-test.*
5 changes: 5 additions & 0 deletions vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

## [Unreleased]

- Initial release
71 changes: 71 additions & 0 deletions vscode-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# vscode-reminder-lint README

This is the README for your extension "vscode-reminder-lint". After writing up a brief description, we recommend including the following sections.

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.

## Requirements

If you have any requirements or dependencies, add a section describing those and how to install and configure them.

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:

This extension contributes the following settings:

* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.

## Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

---

## Following extension guidelines

Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.

* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)

## Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.

## For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
26 changes: 26 additions & 0 deletions vscode-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "vscode-reminder-lint",
"displayName": "reminder-lint",
"description": "",
"version": "0.0.1",
"engines": {
"vscode": "^1.92.0"
},
"categories": ["Other"],
"main": "./out/extension.js",
"activationEvents": ["onStartupFinished"],
"scripts": {
"vscode:prepublish": "pnpm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"check": "biome check .",
"check:write": "biome check --write ."
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@types/mocha": "10.0.7",
"@types/node": "20.14.15",
"@types/vscode": "1.92.0",
"typescript": "5.4.5"
}
}
Loading