Skip to content
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

✨ add prettier to dev deps #181

Merged
merged 6 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
/**@type {import('eslint').Linter.Config} */
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'semi': [2, "always"],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
}
};
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
rules: {
semi: [2, 'always'],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
},
};
8 changes: 4 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

name: CI

# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -27,7 +27,7 @@ jobs:
- run: npm install
- uses: lannonbr/vsce-action@master
with:
args: "package"
args: 'package'

# Runs a single command using the runners shell
# - name: Run a one-line script
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@

# Controls when the action will run.
#on:
# Triggers the workflow on push or pull request events but only for the main branch
#push:
# branches: [ main ]
#pull_request:
# branches: [ main ]

# Triggers the workflow on push or pull request events but only for the main branch
#push:
# branches: [ main ]
#pull_request:
# branches: [ main ]

name: Create And Upload Release Asset

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore artifacts:
build
coverage
out
used_keywords.jsonc
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"singleQuote": true
}
18 changes: 9 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"editor.insertSpaces": false,
"typescript.tsc.autoDetect": "off",
"typescript.preferences.quoteStyle": "single",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
"editor.insertSpaces": false,
"typescript.tsc.autoDetect": "off",
"typescript.preferences.quoteStyle": "single",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
60 changes: 28 additions & 32 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": ["$tsc"]
},
{
"type": "npm",
"script": "watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": ["$tsc-watch"]
}
]
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ All notable changes to the "vscode-nushell-lang" extension will be documented in
- 1.9.0
- Add spread to syntax highlighting [#174](https://github.com/nushell/vscode-nushell-lang/pull/174)
- fix markdown formatting for hover lsp [#175](https://github.com/nushell/vscode-nushell-lang/pull/175)
- update grammar for nushell 0.91.0 [#177](https://github.com/nushell/vscode-nushell-lang/pull/177)
- update grammar for nushell 0.91.0 [#177](https://github.com/nushell/vscode-nushell-lang/pull/177)
68 changes: 34 additions & 34 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,41 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import * as path from "path";
import * as path from 'path';
// import { workspace, ExtensionContext } from "vscode";
import * as vscode from "vscode";
import * as vscode from 'vscode';

import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind,
} from "vscode-languageclient/node";
} from 'vscode-languageclient/node';

let client: LanguageClient;

export function activate(context: vscode.ExtensionContext) {
console.log("Terminals: " + (<any>vscode.window).terminals.length);
console.log('Terminals: ' + (<any>vscode.window).terminals.length);
context.subscriptions.push(
vscode.window.registerTerminalProfileProvider("nushell_default", {
vscode.window.registerTerminalProfileProvider('nushell_default', {
provideTerminalProfile(
token: vscode.CancellationToken
token: vscode.CancellationToken,
): vscode.ProviderResult<vscode.TerminalProfile> {
const which = require("which");
const path = require("path");
const which = require('which');
const path = require('path');

const PATH_FROM_ENV = process.env["PATH"];
const PATH_FROM_ENV = process.env['PATH'];
const pathsToCheck = [
PATH_FROM_ENV,
// cargo install location
(process.env["CARGO_HOME"] || "~/.cargo") + "/bin",
(process.env['CARGO_HOME'] || '~/.cargo') + '/bin',

// winget on Windows install location
"c:\\program files\\nu\\bin",
'c:\\program files\\nu\\bin',
// just add a few other drives for fun
"d:\\program files\\nu\\bin",
"e:\\program files\\nu\\bin",
"f:\\program files\\nu\\bin",
'd:\\program files\\nu\\bin',
'e:\\program files\\nu\\bin',
'f:\\program files\\nu\\bin',

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

// brew install location mac
// intel
"/usr/local/bin",
'/usr/local/bin',
// arm
"/opt/homebrew/bin",
'/opt/homebrew/bin',

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

const found_nushell_path = which.sync("nu", {
const found_nushell_path = which.sync('nu', {
nothrow: true,
path: pathsToCheck.join(path.delimiter),
});

if (found_nushell_path == null) {
console.log(
"Nushell not found in env:PATH or any of the heuristic locations."
'Nushell not found in env:PATH or any of the heuristic locations.',
);
// use an async arrow funciton to use `await` inside
return (async () => {
if (
(await vscode.window.showErrorMessage(
"We cannot find a nushell executable in your path or pre-defined locations",
"install from website"
'We cannot find a nushell executable in your path or pre-defined locations',
'install from website',
)) &&
(await vscode.env.openExternal(
vscode.Uri.parse("https://www.nushell.sh/")
vscode.Uri.parse('https://www.nushell.sh/'),
)) &&
(await vscode.window.showInformationMessage(
"after you install nushell, you might need to reload vscode",
"reload now"
'after you install nushell, you might need to reload vscode',
'reload now',
))
) {
vscode.commands.executeCommand("workbench.action.reloadWindow");
vscode.commands.executeCommand('workbench.action.reloadWindow');
}
// user has already seen error messages, but they didn't click through
// return a promise that never resolve to supress the confusing error
Expand All @@ -103,26 +103,26 @@ export function activate(context: vscode.ExtensionContext) {

return {
options: {
name: "Nushell",
name: 'Nushell',
shellPath: found_nushell_path,
iconPath: vscode.Uri.joinPath(
context.extensionUri,
"assets/nu.svg"
'assets/nu.svg',
),
},
};
},
})
}),
);

// The server is implemented in node
const serverModule = context.asAbsolutePath(
path.join("out", "server", "src", "server.js")
path.join('out', 'server', 'src', 'server.js'),
);

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

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

// Create the language client and start the client.
client = new LanguageClient(
"nushellLanguageServer",
"Nushell Language Server",
'nushellLanguageServer',
'Nushell Language Server',
serverOptions,
clientOptions
clientOptions,
);

// Start the client. This will also launch the server
Expand Down
Loading
Loading