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

vscode extension fails to start when provided binary path #244

Closed
cameronbrill opened this issue Mar 20, 2024 · 4 comments
Closed

vscode extension fails to start when provided binary path #244

cameronbrill opened this issue Mar 20, 2024 · 4 comments

Comments

@cameronbrill
Copy link

my team develops in a monorepo with a python service in subdirectory b/. we install and use ast-grep only for that service, so the ast-grep binary lives in b's virtual environment at b/.venv/bin/ast-grep. I configured the ast-grep extension as such:

{
	"astGrep.serverPath": "b/.venv/bin/ast-grep",
    "astGrep.configPath": "b/sgconfig.yml",
}

This should work, as I can run b/.venv/bin/ast-grep -h in my terminal and get output. However, when opening the monorepo in vs code, the ast grep vs code extension says `ast-grep cannot be started. Make sure it is installed." Thus, we cannot currently use the ast-grep vs code extension.

@HerringtonDarkholme
Copy link
Member

hi, can you try setting serverPath to absolute path?

@cameronbrill
Copy link
Author

so it seems setting serverPath to absolute path allows ast-grep to start (i.e. I don't see the message I was seeing before), however we share vs code workspace settings so that's less than ideal for my teams setup. the way we get this to work with other tools is:

  • with ruff, we're able to list a relative path (i.e. ./b/.venv/bin/ruff)
  • for some other python settings, we use the vs code workspaceFolder variable (i.e. ${workspaceFolder}/b/.venv/bin/whatever).

Back to the topic of getting the extension to work, even when specifying the absolute path, while the error I mentioned in the issue body goes away, it seems that the extension is still not working. there are errors that show up when I run ast-grep scan on my codebase, but I am seeing no squiggly lines on the relevant files. Is there a way to view debug logs for the extension? I don't see anything ast-grep related under the vs code output tab

@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented Mar 20, 2024

Back to the topic of getting the extension to work, even when specifying the absolute path, while the error I mentioned in the issue body goes away, it seems that the extension is still not working.

As far as I can tell from the information you provided, I think the issue should probably be the config path.

    "astGrep.configPath": "b/sgconfig.yml",

The server configPath is not supported yet. only sgconfig.yml in root folder is supported at the moment. #228

Is there a way to view debug logs for the extension? don't see anything ast-grep related under the vs code output tab

Thanks for the suggestion! I will add related output/debugging info in the output tab.

@HerringtonDarkholme
Copy link
Member

I have pushed a fix to solve the binary server issue. Now it always resolves relative to current workspace directory.

The remaining issue is tracked by #228 .

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants