Skip to content

Commit c126aa6

Browse files
authored
cleanup-and-prepare-for-maintainers
chore: modernize repository for new maintainers
2 parents 9bfe056 + f20ac3b commit c126aa6

34 files changed

+6250
-5023
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [18.x, 20.x, 22.x]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: "npm"
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Check formatting
34+
run: npm run format:check
35+
36+
- name: Lint TypeScript
37+
run: npm run lint
38+
39+
- name: Lint Markdown
40+
run: npm run lint:md
41+
42+
- name: Build
43+
run: npm run build
44+
45+
- name: Run tests with coverage
46+
run: npm run test:coverage
47+
48+
- name: Upload coverage to Codecov
49+
if: matrix.node-version == '20.x'
50+
uses: codecov/codecov-action@v4
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
files: ./coverage/lcov.info
54+
fail_ci_if_error: false
55+
verbose: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ gen/
22
out/
33
node_modules/
44
.DS_Store
5+
coverage/
6+
*.lcov
7+
*.vsix

.husky/pre-commit

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx pretty-quick --staged
1+
npx lint-staged
2+
npm run lint
3+
npm run build

.markdownlint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"MD013": {
3+
"line_length": 120,
4+
"tables": false,
5+
"code_blocks": false
6+
},
7+
"MD033": false,
8+
"MD041": false
9+
}

.prettierrc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
2+
"printWidth": 100,
23
"tabWidth": 2,
34
"useTabs": false,
4-
"singleQuote": false,
55
"semi": true,
6-
"printWidth": 120
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"trailingComma": "es5",
9+
"bracketSpacing": true,
10+
"bracketSameLine": false,
11+
"arrowParens": "avoid",
12+
"endOfLine": "lf",
13+
"proseWrap": "preserve"
714
}

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Release Notes
22

3+
## 0.5.7 (Unreleased)
4+
5+
### Development Infrastructure
6+
7+
- Modernized build tooling and dependencies
8+
- Updated TypeScript to 5.7 with strict mode enabled
9+
- Updated ESLint to 9.x with flat config format
10+
- Updated Mocha to 11.x and added c8 for coverage reporting
11+
- Updated Prettier to 3.4 with best practices config
12+
- Updated Husky to 9.x with lint-staged for pre-commit hooks
13+
- Added GitHub Actions CI workflow
14+
- Runs on Node.js 18.x, 20.x, and 22.x
15+
- Includes formatting, linting, build, and test checks
16+
- Uploads coverage reports to Codecov
17+
- Added markdownlint for markdown file linting
18+
- Expanded test suite from 5 to 85 tests (~95% coverage on core modules)
19+
- Added badges to README (CI status, coverage, marketplace)
20+
321
## 0.5.6
422

523
- Added automatic field and enum renumbering on save, enabled by the new `protoc.renumber_on_save` setting.

CONTRIBUTING.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Contributing to vscode-proto3
2+
3+
Thank you for your interest in contributing to vscode-proto3!
4+
5+
## Development Setup
6+
7+
1. Clone the repository:
8+
9+
```bash
10+
git clone https://github.com/zxh0/vscode-proto3.git
11+
cd vscode-proto3
12+
```
13+
14+
2. Install dependencies:
15+
16+
```bash
17+
npm install
18+
```
19+
20+
3. Build the extension:
21+
22+
```bash
23+
npm run build
24+
```
25+
26+
## Available Scripts
27+
28+
| Script | Description |
29+
| ----------------------- | ---------------------------------------- |
30+
| `npm run build` | Compile TypeScript to JavaScript |
31+
| `npm run compile` | Watch mode compilation |
32+
| `npm test` | Run unit tests |
33+
| `npm run test:coverage` | Run tests with coverage report |
34+
| `npm run lint` | Lint TypeScript files |
35+
| `npm run lint:fix` | Lint and auto-fix TypeScript files |
36+
| `npm run lint:md` | Lint Markdown files |
37+
| `npm run lint:md:fix` | Lint and auto-fix Markdown files |
38+
| `npm run format` | Format TypeScript files with Prettier |
39+
| `npm run format:check` | Check formatting without modifying files |
40+
41+
## Running the Extension Locally
42+
43+
1. Open the repository in VS Code
44+
2. Press `F5` to launch a new VS Code window with the extension loaded
45+
3. Open a `.proto` file to test the extension features
46+
47+
## Running Tests
48+
49+
```bash
50+
# Run all tests
51+
npm test
52+
53+
# Run tests with coverage
54+
npm run test:coverage
55+
```
56+
57+
## Code Style
58+
59+
- TypeScript strict mode is enabled
60+
- ESLint enforces code quality rules
61+
- Prettier handles code formatting
62+
- Markdownlint enforces markdown style
63+
64+
Pre-commit hooks automatically run linting and formatting on staged files.
65+
66+
## Submitting Changes
67+
68+
1. Fork the repository
69+
2. Create a feature branch (`git checkout -b feature/my-feature`)
70+
3. Make your changes
71+
4. Ensure all tests pass (`npm test`)
72+
5. Ensure linting passes (`npm run lint && npm run lint:md`)
73+
6. Commit your changes with a descriptive message
74+
7. Push to your fork and submit a pull request
75+
76+
## Reporting Issues
77+
78+
Please use the [GitHub issue tracker](https://github.com/zxh0/vscode-proto3/issues)
79+
to report bugs or request features.
80+
81+
When reporting bugs, please include:
82+
83+
- VS Code version
84+
- Extension version
85+
- Steps to reproduce
86+
- Expected vs actual behavior
87+
- Any relevant `.proto` file content
88+
89+
## License
90+
91+
By contributing, you agree that your contributions will be licensed under the
92+
same license as the project (see LICENSE.txt).

README.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
# vscode-proto3
22

3+
[![CI](https://github.com/zxh0/vscode-proto3/actions/workflows/ci.yml/badge.svg)](https://github.com/zxh0/vscode-proto3/actions/workflows/ci.yml)
4+
[![codecov](https://codecov.io/gh/zxh0/vscode-proto3/branch/master/graph/badge.svg)](https://codecov.io/gh/zxh0/vscode-proto3)
5+
[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/zxh404.vscode-proto3?label=VS%20Code%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3)
6+
[![VS Code Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/zxh404.vscode-proto3)](https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3)
7+
38
![icon](images/vscode_extension_icon.png)
49

510
Protobuf 3 support for Visual Studio Code
611

7-
https://github.com/zxh0/vscode-proto3
8-
9-
10-
11-
12-
13-
⚠️ Project is looking for new maintainers.
14-
If you're interested in helping maintain this VSCode extension, please comment on issue #184.
12+
<https://github.com/zxh0/vscode-proto3>
1513

14+
> ⚠️ **Project is looking for new maintainers.**
15+
> If you're interested in helping maintain this VSCode extension, please comment on issue #184.
1616
1717
[![Help Wanted](https://img.shields.io/badge/maintainer-wanted-red)](...)
1818

19-
20-
21-
### VSCode Commands
19+
## VSCode Commands
2220

2321
_By default **ctrl-shift-p** opens the command prompt._
2422

25-
| Command | Description |
26-
|---------|-------------|
27-
| `proto3: Compile All Protos` | Compiles all workspace protos using [configurations](#extension-settings) defined with `protoc.options`. |
28-
| `proto3: Compile This Proto` | Compiles the active proto using [configurations](#extension-settings) defined with `protoc.options`. |
29-
| `proto3: Renumber Fields/Enum Values` | Renumbers field tags within the selected message (starting from 1) or enum values (starting from 0). |
30-
23+
| Command | Description |
24+
| ------------------------------------- | -------------------------------------------------------------------------------------------------------- |
25+
| `proto3: Compile All Protos` | Compiles all workspace protos using [configurations](#extension-settings) defined with `protoc.options`. |
26+
| `proto3: Compile This Proto` | Compiles the active proto using [configurations](#extension-settings) defined with `protoc.options`. |
27+
| `proto3: Renumber Fields/Enum Values` | Renumbers field tags within the selected message (starting from 1) or enum values (starting from 0). |
3128

3229
## Features
3330

@@ -45,7 +42,9 @@ _By default **ctrl-shift-p** opens the command prompt._
4542

4643
### Renumbering tags
4744

48-
Use the `proto3: Renumber Fields/Enum Values` command (via **Ctrl+Shift+P**) while the cursor is inside a message or enum. The command rewrites the numeric tags so that message fields count up from `1` and enum values start at `0`, saving the effort of manually editing values after inserting or removing entries.
45+
Use the `proto3: Renumber Fields/Enum Values` command (via **Ctrl+Shift+P**) while the cursor is inside
46+
a message or enum. The command rewrites the numeric tags so that message fields count up from `1` and
47+
enum values start at `0`, saving the effort of manually editing values after inserting or removing entries.
4948

5049
### Syntax Highlighting
5150

@@ -61,45 +60,45 @@ to tell the extension the full path of protoc if it is not in `path`.
6160

6261
Below is an example settings.json file which comes from
6362
[example/.vscode](https://github.com/zxh0/vscode-proto3/tree/master/example/.vscode):
63+
6464
```json
6565
{
66-
"protoc": {
67-
"path": "/path/to/protoc",
68-
"compile_on_save": false,
69-
"options": [
70-
"--proto_path=protos/v3",
71-
"--proto_path=protos/v2",
72-
"--proto_path=${workspaceRoot}/proto",
73-
"--proto_path=${env.GOPATH}/src",
74-
"--java_out=gen/java"
75-
]
76-
}
66+
"protoc": {
67+
"path": "/path/to/protoc",
68+
"compile_on_save": false,
69+
"options": [
70+
"--proto_path=protos/v3",
71+
"--proto_path=protos/v2",
72+
"--proto_path=${workspaceRoot}/proto",
73+
"--proto_path=${env.GOPATH}/src",
74+
"--java_out=gen/java"
75+
]
76+
}
7777
}
7878
```
7979

8080
#### Fields
8181

8282
The possible fields under the `protoc` extension settings which can be defined in a `settings.json` file.
8383

84-
| Field | Type | Default | Description |
85-
| ---------------- | -------- | ---------------- | ------------------------------------------------------------------------------ |
86-
| path | string | _protoc in PATH_ | Path to protoc. Defaults to protoc in PATH if omitted. |
87-
| compile_on_save | boolean | false | On `.proto` file save, compiles to `--*_out` location within `options` |
88-
| renumber_on_save | boolean | true | Automatically renumbers message fields and enum values whenever you save |
89-
| compile_all_path | string | Workspace Root | Search Path for `Compile All Protos` action. Defaults to the Workspace Root |
90-
| use_absolute_path| boolean | false | Set `true` for `compile_all_path` search files using absolute path |
91-
| options | string[] | [] | protoc compiler arguments/flags, required for proto validation and compilation |
92-
84+
| Field | Type | Default | Description |
85+
| ----------------- | -------- | ---------------- | ------------------------------------------------------------------------------ |
86+
| path | string | _protoc in PATH_ | Path to protoc. Defaults to protoc in PATH if omitted. |
87+
| compile_on_save | boolean | false | On `.proto` file save, compiles to `--*_out` location within `options` |
88+
| renumber_on_save | boolean | true | Automatically renumbers message fields and enum values whenever you save |
89+
| compile_all_path | string | Workspace Root | Search Path for `Compile All Protos` action. Defaults to the Workspace Root |
90+
| use_absolute_path | boolean | false | Set `true` for `compile_all_path` search files using absolute path |
91+
| options | string[] | [] | protoc compiler arguments/flags, required for proto validation and compilation |
9392

9493
#### In-Line Variables
9594

9695
These variables can be used to inject variables strings within the `protoc` extension configurations. See above for examples.
9796

98-
| Variable | Description |
99-
| ------------- | ---------------------------------------- |
100-
| config.* | Refer settings items in ``Preferences``. |
101-
| env.* | Refer environment variable. |
102-
| workspaceRoot | Returns current workspace root path. |
97+
| Variable | Description |
98+
| ------------- | -------------------------------------- |
99+
| config.\* | Refer settings items in `Preferences`. |
100+
| env.\* | Refer environment variable. |
101+
| workspaceRoot | Returns current workspace root path. |
103102

104103
### Code Completion
105104

@@ -155,9 +154,11 @@ The following snippets are based on
155154

156155
Support "Format Document" if `clang-format` is in path, including custom `style` options.
157156

158-
By default, `clang-format`'s standard coding style will be used for formatting. To define a custom style or use a supported preset add `"clang-format.style"` in VSCode Settings (`settings.json`)
157+
By default, `clang-format`'s standard coding style will be used for formatting. To define a custom
158+
style or use a supported preset add `"clang-format.style"` in VSCode Settings (`settings.json`).
159+
160+
### Example usage
159161

160-
### Example usage:
161162
`"clang-format.style": "google"`
162163

163164
This is the equivalent of executing `clang-format -style=google` from the shell.
@@ -172,7 +173,8 @@ For further formatting options refer to the [official `clang-format` documentati
172173

173174
Auto-completion not works in some situations.
174175

175-
Some users consistently see an error like `spawnsync clang-format enoent` when they save. This happens when the "formatOnSave"-setting is enabled in VSCode and "clang-format" cannot be found. To fix this:
176+
Some users consistently see an error like `spawnsync clang-format enoent` when they save. This happens
177+
when the "formatOnSave"-setting is enabled in VSCode and "clang-format" cannot be found. To fix this:
176178

177179
### On MacOS
178180

0 commit comments

Comments
 (0)