-
Notifications
You must be signed in to change notification settings - Fork 140
feat: Implement flexible time display modes for activity status and a… #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file should be deleted it serves no purpose |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| <div align="center"> | ||
|
|
||
| # VSCord - Developer Guide | ||
|
|
||
| Development documentation for the [VSCord](https://github.com/LeonardSSH/vscord) extension. | ||
|
|
||
| </div> | ||
|
|
||
| <br /> | ||
|
|
||
| ## 🚀 Getting Started | ||
|
|
||
| This guide covers how to set up your environment, build, and run the extension locally. | ||
|
|
||
| ## 🛠️ Prerequisites | ||
|
|
||
| - [Node.js](https://nodejs.org/) | ||
| - [npm](https://www.npmjs.com/) (Node Package Manager) | ||
|
|
||
| ## 📥 Installation | ||
|
|
||
| 1. Clone the repository: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/LeonardSSH/vscord.git | ||
| cd vscord | ||
| ``` | ||
|
|
||
| 2. Install dependencies: | ||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| ## 💻 Running in Development Mode | ||
|
|
||
| To run the extension in development mode with hot-reloading (watch mode): | ||
|
|
||
| 1. Open the project in **Visual Studio Code**. | ||
| 2. Press **F5** to start debugging. This will compile the extension and open a new **Extension Development Host** window. | ||
|
|
||
| Alternatively, you can run the watch script manually in your terminal if you prefer: | ||
|
|
||
| ```bash | ||
| npm run watch | ||
| ``` | ||
|
|
||
| ## 🏗️ Building the Extension | ||
|
|
||
| To compile the source code: | ||
|
|
||
| ```bash | ||
| npm run compile | ||
| ``` | ||
|
|
||
| This runs type checking, linting, and builds the project using `esbuild`. | ||
|
|
||
| ## 📦 Packaging | ||
|
|
||
| To create a `.vsix` package for distribution or manual installation: | ||
|
|
||
| ```bash | ||
| npm run package | ||
| ``` | ||
|
|
||
| or | ||
|
|
||
| ```bash | ||
| vsce package | ||
| ``` | ||
|
|
||
| ## 🧪 Testing | ||
|
|
||
| We recommend running lint checks before pushing changes: | ||
|
|
||
| ```bash | ||
| npm run lint | ||
| ``` | ||
|
|
||
| ## 🔍 Development Notes | ||
|
|
||
| - **Source Code**: All source code is located in the `src` directory. | ||
| - **Entry Point**: `src/extension.ts` is the main entry point of the extension. | ||
| - **Configuration**: Settings are defined in `package.json` under `contributes.configuration` and handled in `src/config.ts`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,12 +98,44 @@ export const activity = async ( | |
|
|
||
| if (isIdling && !config.get(CONFIG_KEYS.Status.Idle.Enabled)) return {}; | ||
|
|
||
| if (config.get(CONFIG_KEYS.Status.ShowElapsedTime)) { | ||
| presence.startTimestamp = config.get(CONFIG_KEYS.Status.ResetElapsedTimePerFile) | ||
| ? Date.now() | ||
| : (previous.startTimestamp ?? Date.now()); | ||
| } else { | ||
| delete presence.startTimestamp; | ||
| const timeMode = config.get(CONFIG_KEYS.Status.Time.Mode); | ||
|
|
||
| switch (timeMode) { | ||
| case "Hidden": | ||
| delete presence.startTimestamp; | ||
| delete presence.endTimestamp; | ||
| break; | ||
| case "Elapsed": | ||
| if (config.get(CONFIG_KEYS.Status.ShowElapsedTime)) { | ||
| presence.startTimestamp = config.get(CONFIG_KEYS.Status.ResetElapsedTimePerFile) | ||
| ? Date.now() | ||
| : (previous.startTimestamp ?? Date.now()); | ||
| } else { | ||
| delete presence.startTimestamp; | ||
| } | ||
| break; | ||
| case "Current Interface": { | ||
| const now = new Date(); | ||
| const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0); | ||
| presence.startTimestamp = midnight.getTime(); | ||
| break; | ||
| } | ||
|
Comment on lines
+108
to
+122
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is also duplicated from the default statement. Should just be the same code path in the switch |
||
| case "Custom": | ||
| presence.startTimestamp = config.get(CONFIG_KEYS.Status.Time.CustomTimestamp); | ||
| break; | ||
| case "Fixed": | ||
| delete presence.startTimestamp; | ||
| delete presence.endTimestamp; | ||
| break; | ||
|
Comment on lines
+126
to
+129
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this does the same thing as "hidden" |
||
| default: | ||
| if (config.get(CONFIG_KEYS.Status.ShowElapsedTime)) { | ||
| presence.startTimestamp = config.get(CONFIG_KEYS.Status.ResetElapsedTimePerFile) | ||
| ? Date.now() | ||
| : (previous.startTimestamp ?? Date.now()); | ||
| } else { | ||
| delete presence.startTimestamp; | ||
| } | ||
| break; | ||
| } | ||
|
|
||
| const detailsEnabled = config.get(CONFIG_KEYS.Status.Details.Enabled); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this field is still used throughout the code base and is not deprecated. It is also used in your switch case block you made here: https://github.com/narcisbugeag/vscord/pull/410/changes#diff-25b8815d592fb665b70c36526091c1dfc73d09988d9199d21c228f825a1a1a75R109