You can configure a vs-code multi-root workspace to include several folders. Eg,
{
"folders": [
{
// Source code
"name": "Product",
"path": "vscode"
},
{
// Docs and release notes
"name": "Documentation",
"path": "vscode-docs"
},
{
// Yeoman extension generator
"name": "Extension generator",
"path": "vscode-generator-code"
}
]
}
I would also like to include a README file from a root directory that pertains to all those folders. Is there a way to do this?
Related
I'm using VSCode multiroot workspaces with remote ssh and git worktrees instead of git branches.
So when working on different branches, the folder containing the code may change and I need to change working folder.
For example, I need frequently to switch between folder /my/path/to/worktree1 to /my/path/to/worktree2 and so on ...
Then everytime I want to switch from worktree1 to worktree2, I manually edit the workspace file and comment/uncomment some lines
{
"folders": [
{
"name": "worktree1",
"path": "/my/path/to/worktree1"
// "name": "worktree2",
// "path": "/my/path/to/worktree2",
},
{
"name": "/other/directory",
"path": "/other/directory"
},
],
...
}
I was wondering if there was a way to define a variable and use it in the folders section, for example my_current_branch:worktree1 and then use it as
{
"folders": [
{
"name": "$my_current_branch",
"path": "/my/path/to/$my_current_branch"
},
...
],
...
}
I insist on the fact that I want to use it in the folders section and not in others sections where I know it is possible.
I am creating a vscode extension which has some custom settings. I have defined the settings in package.json like so:
{
"contributes": {
"configuration":[
{
"title": "Extension",
"properties": {
"Codegenx."A Float": {
"type": "number",
"default": 1.0,
"description": "A sample decimal number"
}
}
}
]
}
}
How can I access these setings in my main extension? And also make sure that I get the updated value if the user changes the settings through the settings.json file or through the VsCode UI?
I am trying to add a simple configuration to my VSCode extension, but I can't find the correct information.
I just want that the user have a string input field, that has a default value, and read it from my typescript code through the vscode library
Can someone provide me and example about which file should I add, where, and how to consume? also if more configurations are needed.
Thanks!
Ok, found
I need to add into my package.json
...
"contributes": {
"commands": [
...
],
"configuration": {
"title": "My Extension",
"properties": {
"myExtension.myProperty": {
"type": "string",
"default": "default",
"description": "description"
}
}
}
},
and consume
vscode.workspace.getConfiguration('myExtension').myProperty;
Did you know if it's possible to write a vscode plugin to match only a given file?
My plugin already works but add snippets for all .json files. I wish to be able to add these snippets only if the current file is composer.json.
My current package.json (partial) is:
{
"contributes": {
"snippets": [
{
"language": "json",
"path": "./snippets/snippets.code-snippets"
}
]
}
}
The idea is to be able to having something like:
{
"contributes": {
"snippets": [
{
"filename": "composer.json", <-- JUST FOR ILLUSTRATION PURPOSE
"path": "./snippets/snippets.code-snippets"
}
]
}
}
Thanks.
What I did:
npm install -g yo generator-code
yo code and selected New Color Theme
Following instructions for name, author etc.
The ready made folder I moved to $HOME/.vscode/extensions (I am on Mac)
Content of my folder:
Inside the themes folder:
I restarted the vscode and from Code->Preferences->Color Theme I chose my theme and have the following error:
The theme was generated with editor. I also tried with theme from colorsublime but I had the same error.
This is package.json file:
{
"name": "random",
"displayName": "randomtheme",
"description": "theme",
"version": "0.0.1",
"publisher": "Milenito",
"engines": {
"vscode": "^1.5.0"
},
"categories": [
"Themes"
],
"contributes": {
"themes": [
{
"label": "Random",
"uiTheme": "vs-dark",
"path": "./themes/milenekai.tmTheme"
}
]
}
}
I really can't see where is the problem. I would appreciate any help.