|
| 1 | +# Contributing to VSCode-Journal |
| 2 | +Thank you so much for your interest in contributing! All types of contributions are encouraged and valued. |
| 3 | + |
| 4 | +## About the Project |
| 5 | +I have been writing notes every day for over 10 years and still use this extension all the time. In the beginning only with Notepad and other text editors. When the first version of Visual Studio Code came out, I saw an opportunity to get to know Typescript better and started developing this extension. That's why I mainly focus on ideas and extensions that help me in my daily work. |
| 6 | + |
| 7 | +The source code reflects this journey. A bit bumpy at the beginning (and still today for sure, all this javascript stuff makes me doubt myself often enough), but it got a bit better with the years. |
| 8 | + |
| 9 | +## How to contribute |
| 10 | + |
| 11 | +There are several ways to contribute. |
| 12 | + |
| 13 | +* If you find any issues, weird behaviour or plain error, don't hesitate to [open an issue](https://github.com/pajoma/vscode-journal/issues/new). I try to react timely, but don't count on it. |
| 14 | +* [Start a discussion](https://github.com/pajoma/vscode-journal/discussions/new) if you have question or feature requests. Or see if there are any other unanswered questions you might be able to answer. |
| 15 | +* Leave a review on the [marketplace](https://marketplace.visualstudio.com/items?itemName=pajoma.vscode-journal&ssr=false#review-details) and keep me motivated ;) |
| 16 | +* Let me buy a beer by [sponsoring](https://github.com/sponsors/pajoma) my work here |
| 17 | + |
| 18 | +If you plan to contribute with updates to the source, follow these steps |
| 19 | + |
| 20 | +* Outline your idea in the discussions. |
| 21 | +* Talk to me on [Gitter](https://gitter.im/dictyo) for further questions. |
| 22 | +* Create a fork, do your thing, and create a pull request. Please write tests if possible. |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +* [Node.js](https://nodejs.org/) v20 or later (includes npm) |
| 27 | +* [Visual Studio Code](https://code.visualstudio.com/) v1.118 or later |
| 28 | + |
| 29 | +## Building the Extension |
| 30 | + |
| 31 | +1. **Clone the repository** and install dependencies: |
| 32 | + |
| 33 | + ```bash |
| 34 | + git clone https://github.com/pajoma/vscode-journal.git |
| 35 | + cd vscode-journal |
| 36 | + npm install |
| 37 | + ``` |
| 38 | + |
| 39 | +2. **Compile the extension** (bundles `src/extension.ts` → `dist/extension.js` via esbuild): |
| 40 | + |
| 41 | + ```bash |
| 42 | + npm run compile |
| 43 | + ``` |
| 44 | + |
| 45 | +3. **Watch mode** — recompiles automatically on file changes: |
| 46 | + |
| 47 | + ```bash |
| 48 | + npm run watch |
| 49 | + ``` |
| 50 | + |
| 51 | +4. **Production build** (minified, no source maps): |
| 52 | + |
| 53 | + ```bash |
| 54 | + npm run package |
| 55 | + ``` |
| 56 | + |
| 57 | +5. **Lint** the source code: |
| 58 | + |
| 59 | + ```bash |
| 60 | + npm run lint |
| 61 | + ``` |
| 62 | + |
| 63 | +## Running the Extension in VS Code |
| 64 | + |
| 65 | +Open the project folder in VS Code. The recommended workflow: |
| 66 | + |
| 67 | +1. Press **F5** (or select **Run → Start Debugging**). |
| 68 | + This launches the **"Run Extension"** configuration, which: |
| 69 | + - Runs `npm run watch` as a pre-launch task (auto-rebuilds on changes) |
| 70 | + - Opens a new VS Code window (Extension Development Host) with the extension loaded |
| 71 | + - Uses `test/ws_manual/` as the workspace folder |
| 72 | + |
| 73 | +2. To run **without a workspace**, select the **"Run Extension without Workspace"** launch configuration from the debug dropdown. |
| 74 | + |
| 75 | +3. Make changes to the source code — esbuild will rebuild automatically. Reload the Extension Development Host window (`Ctrl+R` / `Cmd+R`) to pick up changes. |
| 76 | + |
| 77 | +## Running Tests |
| 78 | + |
| 79 | +Tests are executed inside a VS Code Extension Host using [`@vscode/test-cli`](https://github.com/nicolo-ribaudo/vscode-test-cli). |
| 80 | + |
| 81 | +* **From the terminal** (runs the full pretest + test pipeline): |
| 82 | + |
| 83 | + ```bash |
| 84 | + npm test |
| 85 | + ``` |
| 86 | + |
| 87 | + This will compile tests (`tsc` → `out/`), compile the extension (`esbuild` → `dist/`), lint, and then run the test suite. |
| 88 | + |
| 89 | +* **From VS Code**: select the **"Extension Tests"** launch configuration and press **F5**. This compiles both the extension and tests in watch mode, then runs the tests in the Extension Development Host. |
| 90 | + |
| 91 | +* **Compile tests only** (without running them): |
| 92 | + |
| 93 | + ```bash |
| 94 | + npm run compile-tests |
| 95 | + ``` |
| 96 | + |
| 97 | +## Project Structure |
| 98 | + |
| 99 | +``` |
| 100 | +src/ |
| 101 | +├── extension.ts # Extension entry point (activate/deactivate) |
| 102 | +├── ext/ # VS Code integration (config, startup, dialogues) |
| 103 | +├── actions/ # Business logic (reader, writer, inject, parser) |
| 104 | +├── model/ # Data types and interfaces |
| 105 | +├── provider/ # Commands, code actions, features |
| 106 | +├── util/ # Utilities (controller, logger, dates, paths, strings) |
| 107 | +└── test/ # Test suites |
| 108 | +``` |
| 109 | + |
| 110 | +Key build files: |
| 111 | +- `esbuild.mjs` — Build script (replaces webpack) |
| 112 | +- `eslint.config.mjs` — ESLint flat config |
| 113 | +- `.vscode-test.mjs` — Test runner configuration |
| 114 | +- `tsconfig.json` — TypeScript compiler options |
| 115 | + |
| 116 | +## Code of conduct |
| 117 | + |
| 118 | +Just be decent. |
0 commit comments