Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVCaron committed Sep 3, 2024
1 parent 5a9137a commit 9b5a044
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 224 deletions.
14 changes: 4 additions & 10 deletions nf-scil-extensions/test-data-treeview/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "import",
"format": [ "camelCase", "PascalCase" ]
"format": ["camelCase", "PascalCase"]
}
],
"@typescript-eslint/semi": "warn",
Expand All @@ -22,9 +20,5 @@
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
}
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
4 changes: 2 additions & 2 deletions nf-scil-extensions/test-data-treeview/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@vscode/test-cli';
import { defineConfig } from "@vscode/test-cli";

export default defineConfig({
files: 'out/test/**/*.test.js',
files: "out/test/**/*.test.js",
});
2 changes: 1 addition & 1 deletion nf-scil-extensions/test-data-treeview/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Unreleased]

- Initial release
- Initial release
1 change: 0 additions & 1 deletion nf-scil-extensions/test-data-treeview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ This extension is designed to provide a treeview of test data files for **nf-sci
No release notes yet.

---

82 changes: 40 additions & 42 deletions nf-scil-extensions/test-data-treeview/esbuild.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,54 @@
const esbuild = require("esbuild");

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');
const production = process.argv.includes("--production");
const watch = process.argv.includes("--watch");

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',
name: "esbuild-problem-matcher",

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
setup(build) {
build.onStart(() => {
console.log("[watch] build started");
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log("[watch] build finished");
});
},
};

async function main() {
const ctx = await esbuild.context({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
const ctx = await esbuild.context({
entryPoints: ["src/extension.ts"],
bundle: true,
format: "cjs",
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: "node",
outfile: "dist/extension.js",
external: ["vscode"],
logLevel: "silent",
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

main().catch(e => {
console.error(e);
process.exit(1);
main().catch((e) => {
console.error(e);
process.exit(1);
});
68 changes: 30 additions & 38 deletions nf-scil-extensions/test-data-treeview/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
"use strict";

import * as vscode from 'vscode';
import * as vscode from "vscode";

import { TestDataProvider } from './nfscilTestData';
import { TestDataProvider } from "./nfscilTestData";

export function activate(context: vscode.ExtensionContext) {
const rootPath =
Expand All @@ -14,42 +14,34 @@ export function activate(context: vscode.ExtensionContext) {

const testDataProvider = new TestDataProvider(rootPath, storagePath);

vscode.window.registerTreeDataProvider('nfscilTestData', testDataProvider);

vscode.commands.registerCommand('nfscilTestData.refreshEntry', () =>
testDataProvider.refresh()
);
vscode.commands.registerCommand('nfscilTestData.clearCache', () =>
testDataProvider.clear(false)
);
vscode.commands.registerCommand('nfscilTestData.loadListing', () => {
vscode.window.showOpenDialog({
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
openLabel: 'Load package listing',
filters: {
'JSON files': ['json']
},
defaultUri: rootPath ? vscode.Uri.file(rootPath) : undefined
}).then((uri) => {
if (uri && uri[0]) {
testDataProvider.loadListing(uri[0].fsPath);
}
else {
vscode.window.showErrorMessage('No file selected');
}
});
vscode.window.registerTreeDataProvider("nfscilTestData", testDataProvider);

vscode.commands.registerCommand("nfscilTestData.refreshEntry", () => testDataProvider.refresh());
vscode.commands.registerCommand("nfscilTestData.clearCache", () => testDataProvider.clear(false));
vscode.commands.registerCommand("nfscilTestData.loadListing", () => {
vscode.window
.showOpenDialog({
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
openLabel: "Load package listing",
filters: {
"JSON files": ["json"],
},
defaultUri: rootPath ? vscode.Uri.file(rootPath) : undefined,
})
.then((uri) => {
if (uri && uri[0]) {
testDataProvider.loadListing(uri[0].fsPath);
} else {
vscode.window.showErrorMessage("No file selected");
}
});
});
vscode.commands.registerCommand('nfscilTestData.forceDownloadListing', () =>
testDataProvider.forceDownloadListing()
vscode.commands.registerCommand("nfscilTestData.forceDownloadListing", () =>
testDataProvider.forceDownloadListing(),
);

vscode.commands.registerCommand('nfscilTestData.openInEditor', (element) =>
testDataProvider.openInEditor(element)
);
vscode.commands.registerCommand('nfscilTestData.saveAs', (element) =>
testDataProvider.saveAs(element)
);
vscode.commands.registerCommand("nfscilTestData.openInEditor", (element) => testDataProvider.openInEditor(element));
vscode.commands.registerCommand("nfscilTestData.saveAs", (element) => testDataProvider.saveAs(element));
}

Loading

0 comments on commit 9b5a044

Please sign in to comment.