feature: sweep flotte — convergence canons (validation zod/OpenAPI, buildCsv, no-alert→toast/sonner, publicUser anti-leak, dates dayjs, appshell/profil, lastSeenAt, scrollRestoration) + fixes divers
continuous-integration/drone/tag Build is passing
continuous-integration/drone/tag Build is passing
This commit is contained in:
+17
-17
@@ -7,7 +7,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
const disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => {
|
||||
const url = await vscode.window.showInputBox({
|
||||
prompt: 'Enter the URL:',
|
||||
placeHolder: ''
|
||||
placeHolder: '',
|
||||
});
|
||||
|
||||
if (url) {
|
||||
@@ -24,13 +24,13 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
vscode.window.showWarningMessage('URL is not set. Please set the URL first.');
|
||||
return;
|
||||
}
|
||||
await makeHttpRequest({ event: 'ping'});
|
||||
await makeHttpRequest({ event: 'ping' });
|
||||
vscode.window.showInformationMessage('callUrl done');
|
||||
});
|
||||
context.subscriptions.push(disposable3);
|
||||
|
||||
// detecte une ouverture de fichier / nouvel onglet
|
||||
vscode.window.onDidChangeActiveTextEditor(async editor => {
|
||||
vscode.window.onDidChangeActiveTextEditor(async (editor) => {
|
||||
if (editor) {
|
||||
const filePath = editor.document.fileName;
|
||||
console.log('Opened file:', filePath);
|
||||
@@ -41,7 +41,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
});
|
||||
|
||||
// detecte une sauvegarde de fichier
|
||||
vscode.workspace.onDidSaveTextDocument(async document => {
|
||||
vscode.workspace.onDidSaveTextDocument(async (document) => {
|
||||
const filePath = document.fileName;
|
||||
console.log('Saved file:', filePath);
|
||||
|
||||
@@ -50,25 +50,25 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
});
|
||||
|
||||
// detecte un focus / blur de la fenetre vscode
|
||||
vscode.window.onDidChangeWindowState(async event => {
|
||||
vscode.window.onDidChangeWindowState(async (event) => {
|
||||
console.log('Window state changed:', event.focused);
|
||||
await makeHttpRequest({ event: 'focus', focused: event.focused });
|
||||
});
|
||||
}
|
||||
|
||||
export function deactivate() { }
|
||||
export function deactivate() {}
|
||||
|
||||
/*
|
||||
* extractProjectName will extract a project name from a path
|
||||
* /root/docker/monitoringserver/controller/homeController.js
|
||||
* => monitoringserver
|
||||
*/
|
||||
* extractProjectName will extract a project name from a path
|
||||
* /root/docker/monitoringserver/controller/homeController.js
|
||||
* => monitoringserver
|
||||
*/
|
||||
export function extractProjectName(path: string) {
|
||||
// des c'est l'un des fois l'autre ?
|
||||
// /root/docker/vscodestat/src/extension.ts
|
||||
// \root\docker\vscodestat\src\extension.ts
|
||||
path = path.replace(/\\/g, '/');
|
||||
|
||||
|
||||
const match = path.match(/\/docker\/([^/]+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
@@ -78,8 +78,8 @@ export function extractProjectName(path: string) {
|
||||
}
|
||||
|
||||
/*
|
||||
* fonction qui envoie un event au serveur
|
||||
*/
|
||||
* fonction qui envoie un event au serveur
|
||||
*/
|
||||
async function makeHttpRequest(json: Object) {
|
||||
try {
|
||||
const url = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
|
||||
@@ -91,16 +91,16 @@ async function makeHttpRequest(json: Object) {
|
||||
const rawResponse = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(json)
|
||||
body: JSON.stringify(json),
|
||||
});
|
||||
const content = await rawResponse.json();
|
||||
|
||||
console.log(content);
|
||||
// vscode.window.showInformationMessage('HTTP request successful.');
|
||||
} catch (error:any) {
|
||||
} catch (error: any) {
|
||||
console.error('Error making HTTP request:', error);
|
||||
// vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user