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

[Feature Request]: Default configs #270

Open
andrestone opened this issue Sep 30, 2020 · 11 comments
Open

[Feature Request]: Default configs #270

andrestone opened this issue Sep 30, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@andrestone
Copy link

Maybe it's already there but I really couldn't find it.

How about built-in templates for the most commonly used configurations? It's a bit annoying to have to setup .vimspector.json for every new project I get my hands on.

Ideally, when starting the debugger in a project where a configuration couldn't be found, the Vimspector would ask permission to create a .vimspector.json with the most common / recommended settings for that language and open the file so the user could make small adjustments as needed. After the user saved the file, Vimspector would try starting the debug session again.

@puremourning
Copy link
Owner

puremourning commented Sep 30, 2020

https://trello.com/c/vWvSx2sx

This is certainly aspirational in a sense.

FYI you can configure your debug configs once centrally rather than per-project using the parameterised configs: https://puremourning.github.io/vimspector/configuration.html#debug-configurations

and the powerful replacement vars and defaults: https://puremourning.github.io/vimspector/configuration.html#replacements-and-variables

I do this a lot, but here are some examples: https://github.com/puremourning/.vim-mac/tree/master/vimspector-conf/configurations/macos

@puremourning
Copy link
Owner

There is some stuff in progress here https://github.com/puremourning/vimspector/tree/setup-guide but it's only very much WIP

@puremourning
Copy link
Owner

The main problem with this is maintenance. It's basically a job for life and I'm not sure that I can manage on my own to maintain all of these things. Will need more community involvement to produce and maintain the gadget configs I think and perhaps a way to pull them out of vimspector core and distribute them differently. not sure, but already the number of gadgets I am supporting is too much to keep up to date on my own.

@puremourning puremourning added enhancement New feature or request upcoming feature is good, work in progress or planned. labels Oct 9, 2020
@puremourning
Copy link
Owner

here's a demo of the WIP stuff https://asciinema.org/a/xpSMFSn0GSEFTPNYSfcf0HEIA

I have started to work on a way to separate out the gadget specs to allow the community to more easily contribute them

@stucash
Copy link
Contributor

stucash commented Jan 29, 2024

This is a bit old but I think there's an existing solution to this: creating a global debug config in vimspector installation directory, under <OS>/<filetype>/. If this is working, then I think it is a good alternative for this problem; we just have to write one typical(the most common) config for each filetype and we don't really have to touch it again; only if we have an edge case project we'd have one for that project.

However, I couldn't get the global config to work. vimspector complains that it couldn't find the config and I need to tell vimspector how to launch the application.

I've created vimspector_root/configurations/linux/rust/.vimspector.json with following config:

{
  "$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
  "configurations": {
    "Launch": {
      "adapter": "CodeLLDB",
      "filetypes": ["rust"],
      "configuration": {
        "request": "launch",
        "program": "${workspaceRoot}/target/debug/${fileBasenameNoExtension}",
        "args": [],
        "cwd": "${workspaceRoot}",
        "externalConsole": false,
	"stopOnEntry": true,
        "MIMode": "lldb"
      }
    },
    "Attach": {
      "adapter": "CodeLLDB",
      "filetypes": ["rust"],
      "configuration": {
        "request": "attach",
        "program": "${workspaceRoot}/target/debug/${fileBasenameNoExtension}",
	"PID": "${PID}",
        "args": [],
        "MIMode": "lldb"
      }
    }
  }
}

@puremourning
Copy link
Owner

I've created vimspector_root/configurations/linux/rust/.vimspector.json

rename to ‘rust.json’. Or some other non-hidden file name in that directory

@stucash
Copy link
Contributor

stucash commented Jan 29, 2024

Thanks! for rust vimspector seems to think that the ${workspaceRoot} or ${workspaceFolder} to be root_folder/src for rust, whereas a local config got it correctly as root_folder/.

Typically rust's bin folder is root_folder/target/debug/; the global config thought it was root_folder/src/target/debug; is there a way I work around this?

@puremourning
Copy link
Owner

puremourning commented Jan 29, 2024

I don't understand the question (and it seems not relevant to this issue), but the behaviour of determining the workspace root is documented in the reference guide https://puremourning.github.io/vimspector/configuration.html#project-and-global-configurations

one alternative is to not use ${workspaceRoot} and use, say ${MY_PROJECT_ROOT} (or anything else, which you can then set in vim with :let $MY_PROJECT_ROOT=getcwd() or something. I often have an env var which is the root of my actual project if I'm using centralised configs.

@stucash
Copy link
Contributor

stucash commented Jan 29, 2024

thanks; I'll have a read and I've updated my comment above; hope it clarify the issue I have a little bit.

@stucash
Copy link
Contributor

stucash commented Jan 29, 2024

I don't understand the question (and it seems not relevant to this issue), but the behaviour of determining the workspace root is documented in the reference guide https://puremourning.github.io/vimspector/configuration.html#project-and-global-configurations

one alternative is to not use ${workspaceRoot} and use, say ${MY_PROJECT_ROOT} (or anything else, which you can then set in vim with :let $MY_PROJECT_ROOT=getcwd() or something. I often have an env var which is the root of my actual project if I'm using centralised configs.

Ah that's a good one; I just tried and it worked well.

@luisdavim
Copy link

What about something like: https://github.com/sharksforarms/vimspector-gen

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

No branches or pull requests

4 participants