Skip to content

Commit

Permalink
feat: ✨ add models and providers for feedback functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelGil committed Feb 7, 2024
1 parent b58f3cf commit ecebdaf
Show file tree
Hide file tree
Showing 15 changed files with 576 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ out
dist
node_modules
.vscode-test/
compodoc/
*.vsix
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add compodoc to generate the documentation
- Add `FeedbackProvider` to display the feedback view
- Add `FeedbackController` to handle the feedback view
- Add `NodeModel` to display the items in the feedback view

### Changed

- Update `README.md` to include the features of the extension
- Update `package.json` to include the feedback view in the contributes section

### [1.1.0] - 2024-02-06

### Added
Expand Down
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,57 @@ This is a starter kit for creating a new extension for Visual Studio Code. It in

- [VS Code Extension - Starter Kit](#vs-code-extension---starter-kit)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [Running the documentation](#running-the-documentation)
- [Building the extension](#building-the-extension)
- [Publishing the extension](#publishing-the-extension)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Changelog](#changelog)
- [Authors](#authors)
- [License](#license)

## Features

- Basic configuration for the development environment
- `.editorconfig` - Editor configuration
- `.eslintignore` - ESLint ignore file
- `.eslintrc.json` - ESLint configuration file
- `.linstagedrc` - Lint-staged configuration file
- `.nvmrc` - Node version manager configuration file
- `.prettierrc` - Prettier configuration file
- `commitlint.config.js` - Commit lint configuration file
- `package.json` - Package configuration for the extension
- `tsconfig.json` - TypeScript configuration for the extension
- Basic structure for a new extension
- `app` - Source code for the extension
- `config` - Configuration files for the extension
- `controllers` - Controllers for the extension
- `helpers` - Helper functions for the extension
- `models` - Models for the extension
- `providers` - Providers for the extension
- `services` - Services for the extension
- `test` - Test files for the extension
- JSON Schema validations for workspace settings
- `settings.schema.json` - JSON schema for the workspace settings
- Helper functions to get started with the extension
- `command.helper.ts` - Helper functions to create a new command
- `data.helper.ts` - Helper functions to create a new data provider
- `dialog.helper.ts` - Helper functions to create a new dialog
- `filesystem.helper.ts` - Helper functions to create a new file system provider
- `inflection.helper.ts` - Helper functions to create a new inflection provider
- `number.helper.ts` - Helper functions to create a new number provider
- `security.helper.ts` - Helper functions to create a new security provider
- `text.helper.ts` - Helper functions to create a new text provider
- Basic commands to get started with the extension
- `extension.ts` - Main file for the extension
- `commands` - Commands for the extension
- `example.controller.ts` - Example controller for the extension
- `providers` - Providers for the extension
- `feedback.provider.ts` - Feedback provider for the extension

## Prerequisites

You need to have [node](https://nodejs.org/en/) and [npm](https://nodejs.org/en/) installed on your system to run the examples. It is recommended to use the node version used for VS Code development itself which is documented [here](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites)
Expand All @@ -35,6 +78,42 @@ You need to have [node](https://nodejs.org/en/) and [npm](https://nodejs.org/en/

For more information, see the [official documentation](https://code.visualstudio.com/api/get-started/your-first-extension)

## Running the documentation

To run the documentation, execute the following command in the terminal:

```bash
npm run compodoc
```

This will generate the documentation in the `compodoc` folder.

For more information, see the [official documentation](https://compodoc.app/guides/getting-started.html)

## Building the extension

To build the extension, execute the following command in the terminal:

```bash
vsce package
```

This will create a `.vsix` file in the root of the project.

For more information, see the [official documentation](https://code.visualstudio.com/api/working-with-extensions/publishing-extension)

## Publishing the extension

To publish the extension, execute the following command in the terminal:

```bash
vsce publish
```

This will open a new instance of Visual Studio Code with the extension running in debug mode.

For more information, see the [official documentation](https://code.visualstudio.com/api/get-started/your-first-extension)

## Contributing

Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
Expand Down
57 changes: 52 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@
},
"activationEvents": [
"onCommand:extension-starter-kit.helloWorld",
"onCommand:extension-starter-kit.getFilesInFolder"
"onCommand:extension-starter-kit.getFilesInFolder",
"onCommand:extension-starter-kit.feedback.aboutUs",
"onCommand:extension-starter-kit.feedback.documentation",
"onCommand:extension-starter-kit.feedback.reportIssues",
"onCommand:extension-starter-kit.feedback.rateUs",
"onCommand:extension-starter-kit.feedback.followUs",
"onCommand:extension-starter-kit.feedback.supportUs"
],
"main": "./out/extension.js",
"contributes": {
Expand Down Expand Up @@ -85,6 +91,36 @@
"command": "extension-starter-kit.getFilesInFolder",
"title": "Get Files in Folder",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.aboutUs",
"title": "About Us",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.documentation",
"title": "Documentation",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.reportIssues",
"title": "Report Issues",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.rateUs",
"title": "Rate Us",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.followUs",
"title": "Follow Us",
"category": "Extension name"
},
{
"command": "extension-starter-kit.feedback.supportUs",
"title": "Support Us",
"category": "Extension name"
}
],
"submenus": [
Expand All @@ -109,6 +145,15 @@
}
]
},
"views": {
"explorer": [
{
"id": "extension-starter-kit.feedbackProvider",
"name": "Help and Feedback",
"visibility": "collapsed"
}
]
},
"jsonValidation": [
{
"fileMatch": ".vscode/settings.json",
Expand All @@ -124,26 +169,28 @@
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint src --ext ts --fix",
"test": "node ./out/test/runTest.js",
"compodoc": "npx compodoc -p tsconfig.doc.json -d compodoc --theme readthedocs -s",
"prepare": "husky"
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@compodoc/compodoc": "^1.1.23",
"@types/glob": "^8.1.0",
"@types/minimatch": "^3.0.3",
"@types/minimatch": "^3.0.5",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.16",
"@types/vscode": "^1.86.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"glob": "^10.3.10",
"husky": "^9.0.10",
"lint-staged": "^15.2.1",
"lint-staged": "^15.2.2",
"mocha": "^10.2.0",
"prettier": "3.2.5",
"typescript": "^5.3.3",
Expand Down
12 changes: 9 additions & 3 deletions src/app/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EXCLUDE, INCLUDE } from './constants';
* @classdesc The class that represents the configuration of the extension.
* @export
* @public
* @property {WorkspaceConfiguration} config - The workspace configuration
* @property {string[]} include - The files to include
* @property {string[]} exclude - The files to exclude
* @example
Expand All @@ -16,6 +17,10 @@ import { EXCLUDE, INCLUDE } from './constants';
* console.log(config.exclude);
*/
export class Config {
// -----------------------------------------------------------------
// Properties
// -----------------------------------------------------------------

// Public properties
/**
* The files to include.
Expand Down Expand Up @@ -49,7 +54,7 @@ export class Config {
* @public
* @memberof Config
*/
constructor(config: WorkspaceConfiguration) {
constructor(public readonly config: WorkspaceConfiguration) {
this.include = config.get<string[]>('files.include') ?? INCLUDE;
this.exclude = config.get<string[]>('files.exclude') ?? EXCLUDE;
}
Expand All @@ -58,6 +63,7 @@ export class Config {
// Methods
// -----------------------------------------------------------------

// Public methods
/**
* The update method.
*
Expand All @@ -68,7 +74,7 @@ export class Config {
* const config = new Config(workspace.getConfiguration());
* config.update(workspace.getConfiguration());
*/
public update(config: WorkspaceConfiguration): void {
update(config: WorkspaceConfiguration): void {
this.include = config.get<string[]>('files.include') ?? INCLUDE;
this.exclude = config.get<string[]>('files.exclude') ?? EXCLUDE;
}
Expand All @@ -82,7 +88,7 @@ export class Config {
* const config = new Config(workspace.getConfiguration());
* console.log(config.toString());
*/
public toString(): string {
toString(): string {
return JSON.stringify({ include: this.include, exclude: this.exclude });
}
}
8 changes: 6 additions & 2 deletions src/app/controllers/example.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import {
* const controller = new ExampleController(config);
*/
export class ExampleController {
// -----------------------------------------------------------------
// Properties
// -----------------------------------------------------------------

// Public properties
/**
* The configuration.
Expand Down Expand Up @@ -68,15 +72,15 @@ export class ExampleController {
/**
* The getFilesInFolder method.
*
* @param {Uri | null} path - The path to the folder
* @param {Uri} [path] - The path to the folder
* @public
* @memberof ExampleController
* @example
* controller.getFilesInFolder();
*
* @returns {Promise<void>} - The promise with no return value
*/
public async getFilesInFolder(path: Uri | null): Promise<void> {
public async getFilesInFolder(path?: Uri): Promise<void> {
// Get the relative path
const folderPath: string = path ? await getRelativePath(path.path) : '';

Expand Down
Loading

0 comments on commit ecebdaf

Please sign in to comment.