Skip to content

Commit 92faaf7

Browse files
authored
✨ add prettier to dev deps (#181)
* ✨ add `prettier` to dev deps * 🚚 rename prettierignore * ✨ add `fmt` command to scritps * 🔧 update the prettier config * 🎨 format the code
1 parent ad9472e commit 92faaf7

File tree

21 files changed

+1790
-1811
lines changed

21 files changed

+1790
-1811
lines changed

.eslintrc.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
/**@type {import('eslint').Linter.Config} */
22
// eslint-disable-next-line no-undef
33
module.exports = {
4-
root: true,
5-
parser: '@typescript-eslint/parser',
6-
plugins: [
7-
'@typescript-eslint',
8-
],
9-
extends: [
10-
'eslint:recommended',
11-
'plugin:@typescript-eslint/recommended',
12-
],
13-
rules: {
14-
'semi': [2, "always"],
15-
'@typescript-eslint/no-unused-vars': 0,
16-
'@typescript-eslint/no-explicit-any': 0,
17-
'@typescript-eslint/explicit-module-boundary-types': 0,
18-
'@typescript-eslint/no-non-null-assertion': 0,
19-
}
20-
};
4+
root: true,
5+
parser: '@typescript-eslint/parser',
6+
plugins: ['@typescript-eslint'],
7+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
8+
rules: {
9+
semi: [2, 'always'],
10+
'@typescript-eslint/no-unused-vars': 0,
11+
'@typescript-eslint/no-explicit-any': 0,
12+
'@typescript-eslint/explicit-module-boundary-types': 0,
13+
'@typescript-eslint/no-non-null-assertion': 0,
14+
},
15+
};

.github/workflows/package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
name: CI
44

5-
# Controls when the action will run.
5+
# Controls when the action will run.
66
on:
77
# Triggers the workflow on push or pull request events but only for the main branch
88
push:
9-
branches: [ main ]
9+
branches: [main]
1010
pull_request:
11-
branches: [ main ]
11+
branches: [main]
1212

1313
# Allows you to run this workflow manually from the Actions tab
1414
workflow_dispatch:
@@ -27,7 +27,7 @@ jobs:
2727
- run: npm install
2828
- uses: lannonbr/vsce-action@master
2929
with:
30-
args: "package"
30+
args: 'package'
3131

3232
# Runs a single command using the runners shell
3333
# - name: Run a one-line script

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44

55
# Controls when the action will run.
66
#on:
7-
# Triggers the workflow on push or pull request events but only for the main branch
8-
#push:
9-
# branches: [ main ]
10-
#pull_request:
11-
# branches: [ main ]
12-
7+
# Triggers the workflow on push or pull request events but only for the main branch
8+
#push:
9+
# branches: [ main ]
10+
#pull_request:
11+
# branches: [ main ]
1312

1413
name: Create And Upload Release Asset
1514

1615
on:
1716
push:
1817
# Sequence of patterns matched against refs/tags
1918
tags:
20-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
19+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
2120

2221
# Allows you to run this workflow manually from the Actions tab
2322
workflow_dispatch:

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore artifacts:
2+
build
3+
coverage
4+
out
5+
used_keywords.jsonc

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"singleQuote": true
4+
}

.vscode/settings.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"editor.insertSpaces": false,
3-
"typescript.tsc.autoDetect": "off",
4-
"typescript.preferences.quoteStyle": "single",
5-
"editor.codeActionsOnSave": {
6-
"source.fixAll.eslint": "explicit"
7-
},
8-
"editor.formatOnSave": true,
9-
"editor.defaultFormatter": "esbenp.prettier-vscode"
10-
}
2+
"editor.insertSpaces": false,
3+
"typescript.tsc.autoDetect": "off",
4+
"typescript.preferences.quoteStyle": "single",
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": "explicit"
7+
},
8+
"editor.formatOnSave": true,
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
}

.vscode/tasks.json

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
// See https://go.microsoft.com/fwlink/?LinkId=733558
22
// for the documentation about the tasks.json format
33
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"type": "npm",
8-
"script": "compile",
9-
"group": "build",
10-
"presentation": {
11-
"panel": "dedicated",
12-
"reveal": "never"
13-
},
14-
"problemMatcher": [
15-
"$tsc"
16-
]
17-
},
18-
{
19-
"type": "npm",
20-
"script": "watch",
21-
"isBackground": true,
22-
"group": {
23-
"kind": "build",
24-
"isDefault": true
25-
},
26-
"presentation": {
27-
"panel": "dedicated",
28-
"reveal": "never"
29-
},
30-
"problemMatcher": [
31-
"$tsc-watch"
32-
]
33-
}
34-
]
35-
}
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "compile",
9+
"group": "build",
10+
"presentation": {
11+
"panel": "dedicated",
12+
"reveal": "never"
13+
},
14+
"problemMatcher": ["$tsc"]
15+
},
16+
{
17+
"type": "npm",
18+
"script": "watch",
19+
"isBackground": true,
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
"presentation": {
25+
"panel": "dedicated",
26+
"reveal": "never"
27+
},
28+
"problemMatcher": ["$tsc-watch"]
29+
}
30+
]
31+
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ All notable changes to the "vscode-nushell-lang" extension will be documented in
166166
- 1.9.0
167167
- Add spread to syntax highlighting [#174](https://github.com/nushell/vscode-nushell-lang/pull/174)
168168
- fix markdown formatting for hover lsp [#175](https://github.com/nushell/vscode-nushell-lang/pull/175)
169-
- update grammar for nushell 0.91.0 [#177](https://github.com/nushell/vscode-nushell-lang/pull/177)
169+
- update grammar for nushell 0.91.0 [#177](https://github.com/nushell/vscode-nushell-lang/pull/177)

client/src/extension.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,41 @@
44
* Licensed under the MIT License. See License.txt in the project root for license information.
55
* ------------------------------------------------------------------------------------------ */
66

7-
import * as path from "path";
7+
import * as path from 'path';
88
// import { workspace, ExtensionContext } from "vscode";
9-
import * as vscode from "vscode";
9+
import * as vscode from 'vscode';
1010

1111
import {
1212
LanguageClient,
1313
LanguageClientOptions,
1414
ServerOptions,
1515
TransportKind,
16-
} from "vscode-languageclient/node";
16+
} from 'vscode-languageclient/node';
1717

1818
let client: LanguageClient;
1919

2020
export function activate(context: vscode.ExtensionContext) {
21-
console.log("Terminals: " + (<any>vscode.window).terminals.length);
21+
console.log('Terminals: ' + (<any>vscode.window).terminals.length);
2222
context.subscriptions.push(
23-
vscode.window.registerTerminalProfileProvider("nushell_default", {
23+
vscode.window.registerTerminalProfileProvider('nushell_default', {
2424
provideTerminalProfile(
25-
token: vscode.CancellationToken
25+
token: vscode.CancellationToken,
2626
): vscode.ProviderResult<vscode.TerminalProfile> {
27-
const which = require("which");
28-
const path = require("path");
27+
const which = require('which');
28+
const path = require('path');
2929

30-
const PATH_FROM_ENV = process.env["PATH"];
30+
const PATH_FROM_ENV = process.env['PATH'];
3131
const pathsToCheck = [
3232
PATH_FROM_ENV,
3333
// cargo install location
34-
(process.env["CARGO_HOME"] || "~/.cargo") + "/bin",
34+
(process.env['CARGO_HOME'] || '~/.cargo') + '/bin',
3535

3636
// winget on Windows install location
37-
"c:\\program files\\nu\\bin",
37+
'c:\\program files\\nu\\bin',
3838
// just add a few other drives for fun
39-
"d:\\program files\\nu\\bin",
40-
"e:\\program files\\nu\\bin",
41-
"f:\\program files\\nu\\bin",
39+
'd:\\program files\\nu\\bin',
40+
'e:\\program files\\nu\\bin',
41+
'f:\\program files\\nu\\bin',
4242

4343
// SCOOP:TODO
4444
// all user installed programs and scoop itself install to
@@ -60,40 +60,40 @@ export function activate(context: vscode.ExtensionContext) {
6060

6161
// brew install location mac
6262
// intel
63-
"/usr/local/bin",
63+
'/usr/local/bin',
6464
// arm
65-
"/opt/homebrew/bin",
65+
'/opt/homebrew/bin',
6666

6767
// native package manager install location
6868
// standard location should be in `PATH` env var
6969
//"/usr/bin/nu",
7070
];
7171

72-
const found_nushell_path = which.sync("nu", {
72+
const found_nushell_path = which.sync('nu', {
7373
nothrow: true,
7474
path: pathsToCheck.join(path.delimiter),
7575
});
7676

7777
if (found_nushell_path == null) {
7878
console.log(
79-
"Nushell not found in env:PATH or any of the heuristic locations."
79+
'Nushell not found in env:PATH or any of the heuristic locations.',
8080
);
8181
// use an async arrow funciton to use `await` inside
8282
return (async () => {
8383
if (
8484
(await vscode.window.showErrorMessage(
85-
"We cannot find a nushell executable in your path or pre-defined locations",
86-
"install from website"
85+
'We cannot find a nushell executable in your path or pre-defined locations',
86+
'install from website',
8787
)) &&
8888
(await vscode.env.openExternal(
89-
vscode.Uri.parse("https://www.nushell.sh/")
89+
vscode.Uri.parse('https://www.nushell.sh/'),
9090
)) &&
9191
(await vscode.window.showInformationMessage(
92-
"after you install nushell, you might need to reload vscode",
93-
"reload now"
92+
'after you install nushell, you might need to reload vscode',
93+
'reload now',
9494
))
9595
) {
96-
vscode.commands.executeCommand("workbench.action.reloadWindow");
96+
vscode.commands.executeCommand('workbench.action.reloadWindow');
9797
}
9898
// user has already seen error messages, but they didn't click through
9999
// return a promise that never resolve to supress the confusing error
@@ -103,26 +103,26 @@ export function activate(context: vscode.ExtensionContext) {
103103

104104
return {
105105
options: {
106-
name: "Nushell",
106+
name: 'Nushell',
107107
shellPath: found_nushell_path,
108108
iconPath: vscode.Uri.joinPath(
109109
context.extensionUri,
110-
"assets/nu.svg"
110+
'assets/nu.svg',
111111
),
112112
},
113113
};
114114
},
115-
})
115+
}),
116116
);
117117

118118
// The server is implemented in node
119119
const serverModule = context.asAbsolutePath(
120-
path.join("out", "server", "src", "server.js")
120+
path.join('out', 'server', 'src', 'server.js'),
121121
);
122122

123123
// The debug options for the server
124124
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
125-
const debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] };
125+
const debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
126126

127127
// If the extension is launched in debug mode then the debug server options are used
128128
// Otherwise the run options are used
@@ -138,10 +138,10 @@ export function activate(context: vscode.ExtensionContext) {
138138
// Options to control the language client
139139
const clientOptions: LanguageClientOptions = {
140140
// Register the server for plain text documents
141-
documentSelector: [{ scheme: "file", language: "nushell" }],
141+
documentSelector: [{ scheme: 'file', language: 'nushell' }],
142142
synchronize: {
143143
// Notify the server about file changes to '.clientrc files contained in the workspace
144-
fileEvents: vscode.workspace.createFileSystemWatcher("**/.clientrc"),
144+
fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc'),
145145
},
146146
markdown: {
147147
isTrusted: true
@@ -150,10 +150,10 @@ export function activate(context: vscode.ExtensionContext) {
150150

151151
// Create the language client and start the client.
152152
client = new LanguageClient(
153-
"nushellLanguageServer",
154-
"Nushell Language Server",
153+
'nushellLanguageServer',
154+
'Nushell Language Server',
155155
serverOptions,
156-
clientOptions
156+
clientOptions,
157157
);
158158

159159
// Start the client. This will also launch the server

0 commit comments

Comments
 (0)