microsoft / vscode-azureAutomation

MIT License
16 stars 4 forks source link

"please input local working directory" causes VSCode to become unusable #58

Open foxt opened 7 months ago

foxt commented 7 months ago

Hello,

I just signed into Azure in VS Code, and every time I try to invoke the Azure tab in VSCode I get a box asking for a local working directory. I either enter a path or select enter and then it gets stuck in a loop of bringing focus to the textbox and clearing the textbox, meaning I cannot use VSCode until I quit it and restart it.

https://github.com/microsoft/vscode-azureAutomation/assets/12257112/ad3cb16e-41e3-4248-9633-012c787706d7

Shruti-MS commented 7 months ago

@foxt can you please help with the your OS version.

foxt commented 7 months ago

@foxt can you please help with the your OS version.

Hi @Shruti-MS, it's macOS Sonoma.

dinoinyourhead commented 6 months ago

I have exactly the same issue :-( @Shruti-MS

Fe-Roth-lix commented 6 months ago

I'm also experiencing the same problem since today, but on Windows....

mattpeach1484 commented 4 months ago

Has anyone fixed this who has experienced it in the past? I'm also experiencing this issue.

Version: 1.88.1 (user setup) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:41:02.734Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

KingBain commented 2 months ago

Having the same issue when I am working in vscode + github codespace/devcontainer

Myraas commented 2 weeks ago

I'm also experiencing this problem, 7 months after the original post. Please fix this bug. MacOS Sonoma.

Shruti-MS commented 2 weeks ago

const fs = require('fs'); const path = require('path');

// Function to append a slash prefix to a directory path function appendSlashPrefixToDir(dir) { if (!process.platform.startsWith("win")) { dir = '/' + dir; } return dir; }

// Function to check if a directory exists async function checkDirectory(value) { if (process.platform.startsWith("win")) { // Windows-specific code value = value || ""; if (value === "") { console.error('${value}' directory does not exist.); } else { if (!fs.existsSync(value)) { console.error('${value}' directory does not exist.); } } } else { // macOS/Linux-specific code value = value || ""; if (value !== "" && value.startsWith("/")) { value = value.substring(1); } if (value === "" || !fs.existsSync(appendSlashPrefixToDir(value))) { console.error('${value}' directory does not exist.); } } }

// Get the directory path from command-line arguments const dirPath = process.argv[2];

// Validate input if (!dirPath) { console.log('Please provide a directory path as a command-line argument.'); } else { checkDirectory(dirPath).then(() => console.log('Directory check complete.')).catch(err => console.error('Error:', err)); }

Please can you run this js script once and check why your input directory is not taken as valid input....Would help us in finding the bug. As from our end it is not reproducible.

Thanks for support.

Myraas commented 2 weeks ago

I'm not familiar with JavaScript. I installed Node and the Prettier extension. The provided code reported problems so I made some changes. Here is the code I debugged and the results after running.

const fs = require("fs"); const path = require("path");

// Function to append a slash prefix to a directory path function appendSlashPrefixToDir(dir) { console.log("Original dir:", dir); if (!process.platform.startsWith("win")) { dir = "/" + dir; } console.log("Updated dir:", dir); return dir; }

// Function to check if a directory exists async function checkDirectory(value) { console.log("checkDirectory called with:", value); if (process.platform.startsWith("win")) { // Windows-specific code value = value || ""; if (value === "") { console.error(${value} directory does not exist.); } else { if (!fs.existsSync(value)) { console.error(${value} directory does not exist.); } else { console.log(${value} directory exists.); } } } else { // macOS/Linux-specific code value = value || ""; if (value !== "" && value.startsWith("/")) { value = value.substring(1); } console.log("Processed value:", value); if (value === "" || !fs.existsSync(appendSlashPrefixToDir(value))) { console.error(${value} directory does not exist.); } else { console.log(${value} directory exists.); } } }

// Get the directory path from command-line arguments const dirPath = process.argv[2];

// Validate input if (!dirPath) { console.log("Please provide a directory path as a command-line argument."); } else { checkDirectory(dirPath) .then(() => console.log("Directory check complete.")) .catch((err) => console.error("Error:", err)); }

Results:PS /Users/xenesthis/VSCode/JavaScript> node test.js /Users/xenesthis checkDirectory called with: /Users/xenesthis Processed value: Users/xenesthis Original dir: Users/xenesthis Updated dir: /Users/xenesthis Users/xenesthis directory exists. Directory check complete. PS /Users/xenesthis/VSCode/JavaScript>

Shruti-MS commented 2 weeks ago

@Myraas Thanks for checking.

While we fix the issue, can you try this workaround:-

  1. Open Settings in Visual Studio Code
  2. Go to Workspace ---> Extensions
  3. Go to Azure Automation
  4. Edit Directory>Base Path variable , put your desired path here image

In case you are not able to open settings due to this issue, In your current workspace under .vscode folder , settings.json file would be created edit azureAutomation.directory.basePath variable there image

Please check if this works.

Thanks

Myraas commented 1 week ago

Thank you! This worked for me on MacOS.

Base path is updated to "/Users/User/AzureAutomation"

On Sun, Aug 25, 2024 at 6:51 AM Shruti-MS @.***> wrote:

Thanks for checking.

While we fix the issue, can you try this workaround:-

  1. Open Settings in Visual Studio Code
  2. Go to Workspace ---> Extensions
  3. Go to Azure Automation
  4. Edit Directory>Base Path variable , put your desired path here image.png (view on web) https://github.com/user-attachments/assets/7e474eaa-0c16-4dc6-9805-20fee8752f11

In case you are not able to open settings due to this issue, In your current workspace under .vscode folder , settings.json file would be created edit azureAutomation.directory.basePath variable there image.png (view on web) https://github.com/user-attachments/assets/bd4e469f-1987-4590-aba5-48f93dd9b81c

Please check if this works.

Thanks

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-azureAutomation/issues/58#issuecomment-2308853921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKF73Q4K27RTY5H47M6NJTZTHOM3AVCNFSM6AAAAABCNJX5J2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYHA2TGOJSGE . You are receiving this because you commented.Message ID: @.***>