Skip to content

Commit

Permalink
Merge #34
Browse files Browse the repository at this point in the history
34:  Start using prettier r=noppej a=dbrgn

Updated version of #32.

To check formatting:

    npx prettier --check .

To reformat:

    npx prettier -w .

Co-authored-by: Danilo Bargen <[email protected]>
  • Loading branch information
bors[bot] and dbrgn authored Jan 1, 2023
2 parents 1efd116 + 62f2f82 commit 4a1a259
Show file tree
Hide file tree
Showing 17 changed files with 1,170 additions and 1,025 deletions.
4 changes: 1 addition & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
Expand Down
12 changes: 12 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used to ignore certain commits (e.g. reformatting) in git blame.
#
# To use it, invoke `git blame` like this:
#
# git blame --ignore-revs-file .git-blame-ignore-revs
#
# Alternatively, make this the default:
#
# git config [--global] blame.ignoreRevsFile .git-blame-ignore-revs

# 2022-12-31: Reformat code with prettier
fcc2ef44edfc1cc2bc10ade2522e7baf942ae090
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: yarn install
- run: xvfb-run -a yarn pretest
if: runner.os == 'Linux'
- run: yarn pretest
if: runner.os != 'Linux'
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: yarn install
- run: xvfb-run -a yarn pretest
if: runner.os == 'Linux'
- run: yarn pretest
if: runner.os != 'Linux'
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules/
/dist/
/out/
/dap/
/package-lock.json
**/*.md
15 changes: 15 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Global rules
arrowParens: always
bracketSpacing: false
endOfLine: lf
printWidth: 100
quoteProps: consistent
singleQuote: true
tabWidth: 4
trailingComma: all

# Overrides
overrides:
- files: '*.yml'
options:
tabWidth: 2
17 changes: 9 additions & 8 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"amodio.tsl-problem-matcher",
"ms-vscode.hexeditor"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"amodio.tsl-problem-matcher",
"ms-vscode.hexeditor",
"esbenp.prettier-vscode"
]
}
28 changes: 12 additions & 16 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
],
"outFiles": [
"${workspaceFolder}/dist/ext/**/*.js"
],
"preLaunchTask": "npm: watch"
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/ext/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
}
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
"typescript.tsc.autoDetect": "off",
// Enable prettier format on save
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": false
}
17 changes: 4 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,19 @@
"script": "watch",
"group": "build",
"isBackground": true,
"problemMatcher": [
"$ts-webpack-watch",
"$tslint-webpack-watch"
]
"problemMatcher": ["$ts-webpack-watch", "$tslint-webpack-watch"]
},
{
"type": "npm",
"script": "compile-web",
"problemMatcher": [
"$ts-webpack",
"$tslint-webpack"
]
"problemMatcher": ["$ts-webpack", "$tslint-webpack"]
},
{
"type": "npm",
"script": "watch-web",
"group": "build",
"isBackground": true,
"problemMatcher": [
"$ts-webpack-watch",
"$tslint-webpack-watch"
]
"problemMatcher": ["$ts-webpack-watch", "$tslint-webpack-watch"]
}
]
}
}
104 changes: 66 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,93 @@
# VS Code probe-rs-debugger


## Documentation
Full documentation on Installation, Configuration and supported functionality can be found at [the probe-rs webpage](https://probe.rs/docs/tools/vscode/) and under the [visual tour heading](https://probe.rs/docs/tools/vscode/#a-visual-guide-of-implemented-features)

![<img src="images/probe-rs-debugger.gif" style="margin-top: 1em; margin-bottom: 1em; max-width:100%; max-height:100%; width: auto; height: auto;" />](images/probe-rs-debugger.gif)
Full documentation on Installation, Configuration and supported functionality
can be found at [the probe-rs webpage](https://probe.rs/docs/tools/vscode/) and
under the [visual tour
heading](https://probe.rs/docs/tools/vscode/#a-visual-guide-of-implemented-features)

![<img src="images/probe-rs-debugger.gif" style="margin-top: 1em; margin-bottom: 1em; max-width:100%; max-height:100%; width: auto; height: auto;" />](images/probe-rs-debugger.gif)

## Development Setup

To work on this extensions, you first need to install VS Code and nodejs. Afterwards, follow the following steps:

- Install yarn:
```bash
npm install -g yarn
```
- Checkout this repository
- Inside the repository, install the prerequisites:
```bash
yarn
```
- Install the extensions VS Code recommends. If you prefer to do this manually, you can find the list of recommended extensions in the repository's `.vscode/settings.json' file. These can then be installed from the command line, for example:
```bash
code --install-extension amodio.tsl-problem-matcher
```
- Open VS Code
- Press F5 to start a new VS Code instance where the extension can be debugged. You can also open the "Run and Debug" panel in the left sidebar, and then start the "Extension" debug configuration.
To work on this extensions, you first need to install VS Code and nodejs.
Afterwards, follow the following steps:

* Install yarn:

npm install -g yarn

* Checkout this repository
* Inside the repository, install the prerequisites:

yarn

* Install the extensions VS Code recommends. If you prefer to do this manually,
you can find the list of recommended extensions in the repository's
`.vscode/settings.json' file. These can then be installed from the command
line, for example:

code --install-extension amodio.tsl-problem-matcher

* Open VS Code
* Press F5 to start a new VS Code instance where the extension can be debugged.
You can also open the "Run and Debug" panel in the left sidebar, and then
start the "Extension" debug configuration.

### To run against a compiled executable of `probe-rs-debugger`

* Modify the `debug-example` entry in '.vscode/launch.json' file to point to your target project.
* Press `F5` to __build and launch executable__ `probe-rs-debugger`. VSCode will open another VS Code window. In that window,
* Modify the `debug-example` entry in '.vscode/launch.json' file to point to
your target project.
* Press `F5` to __build and launch executable__ `probe-rs-debugger`. VSCode will
open another VS Code window. In that window,
* You will see the `debug-example` project you just configured.
* Select the debug environment `probe_rs Executable Test`.* Press `F5` to start debugging.

* Select the debug environment `probe_rs Executable Test`.* Press `F5` to start
debugging.

### To run against a debuggable instance of `probe-rs-debugger`

* Clone the [probe-rs](https://github.com/probe-rs/probe-rs.git) repository, and open it in VSCode.
* In this `probe-rs` repo, select the debug environment `DAP-Server probe-rs-debugger`
* Clone the [probe-rs](https://github.com/probe-rs/probe-rs.git) repository, and
open it in VSCode.
* In this `probe-rs` repo, select the debug environment `DAP-Server
probe-rs-debugger`
* Press `F5` to start `probe-rs-debugger` as a debuggable server.
* Switch to the VSCode instance of the probe-rs `vscode` repository.
* Modify the `debug-example` entry in '.vscode/launch.json' file to point to your target project.
* Press `F5` to __build and attach to the debuggable server instance of__ `probe-rs-debugger`. VSCode will open another VS Code window. In that window:
* Switch to the VSCode instance of the probe-rs `vscode` repository.
* Modify the `debug-example` entry in '.vscode/launch.json' file to point to
your target project.
* Press `F5` to __build and attach to the debuggable server instance of__
`probe-rs-debugger`. VSCode will open another VS Code window. In that
window:
* You will see the `debug-example` project you just configured.
* Select the debug environment `probe_rs Server Test`.
* Press `F5` to start debugging.

## Generating and releasing the extension
Because the extension is still regarded as being in 'Alpha' state, it is NOT being released on the Microsoft Visual Studio Code Extension Marketplace. The only way to get access to updated versions of the extension is to build it yourself, or to download it from the [GitHub release page](#development-setup) for this extension.

Because the extension is still regarded as being in 'Alpha' state, it is NOT
being released on the Microsoft Visual Studio Code Extension Marketplace. The
only way to get access to updated versions of the extension is to build it
yourself, or to download it from the [GitHub release page](#development-setup)
for this extension.

### Build the extension
Building the extension refers to the process that generates the installable `.vsix` package.
* Follow the instructions to [setup your development environment](#development-setup).

Building the extension refers to the process that generates the installable
`.vsix` package.

* Follow the instructions to [setup your development
environment](#development-setup).
* In a terminal window, execute the following command:
```
yarn probe-rs:package
```

yarn probe-rs:package

* This will generate a .vsix file in the root of the repository

### Updating the GitHub release page
* Whenever any PR has been merged, you need to create a new release and upload the `.vsix` in the repository's [release page](https://github.com/probe-rs/vscode/releases).
* This means that every PR needs to update the version number appropriately in the `package.json` file. Please [see the Semantic Versioning guidelines](https://semver.org/).

* Whenever any PR has been merged, you need to create a new release and upload
the `.vsix` in the repository's [release
page](https://github.com/probe-rs/vscode/releases).
* This means that every PR needs to update the version number appropriately in
the `package.json` file. Please [see the Semantic Versioning
guidelines](https://semver.org/).
85 changes: 45 additions & 40 deletions build/extension.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,48 @@
const path = require('path');

module.exports = /** @type WebpackConfig */ {
context: path.dirname(__dirname),
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: 'node', // vscode extensions run in a Node.js-context
entry: {
extension: './src/extension.ts'
},
resolve: { // support reading TypeScript and JavaScript files
extensions: ['.ts', '.js']
},
node: {
__dirname: false, // leave the __dirname-behaviour intact
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
use: [{
// configure TypeScript loader:
// * enable sources maps for end-to-end source maps
loader: 'ts-loader',
options: {
compilerOptions: {
'sourceMap': true,
'declaration': false
}
}
}]
}]
},
externals: {
vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed
},
output: {
filename: 'extension.js',
path: path.resolve(__dirname, '../dist/ext'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: "../../[resource-path]"
},
devtool: 'source-map'
}
context: path.dirname(__dirname),
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: 'node', // vscode extensions run in a Node.js-context
entry: {
extension: './src/extension.ts',
},
resolve: {
// support reading TypeScript and JavaScript files
extensions: ['.ts', '.js'],
},
node: {
__dirname: false, // leave the __dirname-behaviour intact
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
// configure TypeScript loader:
// * enable sources maps for end-to-end source maps
loader: 'ts-loader',
options: {
compilerOptions: {
sourceMap: true,
declaration: false,
},
},
},
],
},
],
},
externals: {
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed
},
output: {
filename: 'extension.js',
path: path.resolve(__dirname, '../dist/ext'),
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../../[resource-path]',
},
devtool: 'source-map',
};
Loading

0 comments on commit 4a1a259

Please sign in to comment.