Give directories nicknames in Visual Studio Code - linux

I am currently using SSH-Remote add-on for VisualStudioCode and some directories are having numbered names due to docker usage, my question is:
"Can i somehow 'rename' them without actually making changes to directory name"
With this i would give folder a nickname or a alias shown only to me and not changing actual values on my VPS

As a workaround you can add those folders to a workspace in VS Code, save the workspace and then edit the .code-workspace file you just saved to add a new node "name" where you can add custom names to the folder without actually renaming them.
{
"folders": [
{
"path": "../path/to/your/directory1"
},
{
"path": "../path/to/your/directory2"
}
],
"settings": {}
}
from this to
{
"folders": [
{
"path": "../path/to/your/directory1",
"name": "Your Custom NickName1"
},
{
"path": "../path/to/your/directory2",
"name": "Your Custom NickName2"
}
],
"settings": {}
}

Related

Structural ordering for search

I am looking for a way to implement a structural ordering for a search. I use Azure search and have indexes (simplified):
[
{
"id": Guid,
"name": string,
"folderId": Guid
}
]
name field is the field I am executing the search queries against. And the folder - obviously, the folder the object lives in.
Suppose I have a folder structure:
[
{
"id": "a595885e-520e-4fd2-9bdd-3f494f187b2e",
"name": "folder1"
"searchObjects": [],
"folders": [
{
"id": "f760f2bd-7291-49ed-9be2-9546ce57fb87",
"name": "subfolder1",
"searchObjects": [],
"folders": []
}
]
},
{
"id": "200ff3b6-310a-49d1-ad99-aed6f34a8f38",
"name": "folder2",
"searchObjects": [],
"folders": []
}
]
And each of these folders has 3000 searchable objects.
What I would like to achieve is I want to paginate the search results and retrieve these pages accordingly to the folders structure. For example, let's say I query 5000 objects with each request. In this case, I would get:
1 page - 3000 items from folder1 + 2000 items from subfolder1;
2 page - 1000 items from subfolder1 + 3000 items from folder2;
The initial thought was to calculate a certain folder index before putting the searchable objects into Azure Search. e.g. folder index:
[
{
"index": 1
"name": "folder1"
"folders": [
{
"index": 11,
"name": "subfolder1"
},
{
"index": 12,
"name": "subfolder2"
},
{
"index": 13,
"name": "subfolder3"
"folders": [
{
"index": 131,
"name": "subSubfolder1"
}
]
}
]
},
{
"index": 2
"name": "folder2"
"folders": [
{
"index": 21,
"name": "subfolder2"
}
]
}
]
Searchable objects:
[
{
"id": "3d4374ec-18a0-4e5b-bb55-e7576b475cdb",
"name": "this object is in folder1",
"folderIndex": 1
},
{
"id": "3d4374ec-18a0-4e5b-bb55-e7576b475cdb",
"name": "this object is in subSubfolder1",
"folderIndex": 131
},
{
"id": "2c2c02ec-3f57-4c85-886e-df6603718d44",
"name": "this object is in subfolder1",
"folderIndex": 11
},
...
]
This would allow me to search by the name and order by the folder structure:
search=this object&$top=5000&$searchFields=name&$orderby=folderIndex,name
When I put/change one or even a thousand of objects in a folder it works fine, I just index/reindex these objects on Azure Search side. But it doesn't work in scale. I may have hundreds of folders folded into each other and each of these folders may contain thousands of objects. So if I reorganize the folders it becomes a mess. I have to recalculate almost all of the objects starting from the top folder in the changing tree down to the bottom leaves.
This would be much easier with a relational structure where I could store folders with their indexes separately from the searchable objects, join them by folder IDs and order by the folder indexer all the same, but ...
Is there a way of doing this right?
Is the folder index being kept just for the reason of ordering the result set by folder path? If that's the case, why not keep full folder paths as a sortable field in the original index? This way you'll be able to order the result set by folder paths, assuming the folder path order you want is alphabetical.
For example:
Doc1: “field1”
Doc2: ”field1”
Doc3: “field1\subfield11\subfield111”
Doc4: ”field2”

"Failed to delete integration runtime." Azure Data Factory

I have two integration runtimes(both are self-hosted). When I try to delete one I get an error message.
Error: Failed to delete integration runtime.
Detail: The document cannot be deleted since it is referenced by AzureSqlDatabaseContoso.
But this is not true. At the moment there is no such thing as "AzureSqlDatabaseContoso". Perhaps it might have been there before. I did a search on source code as well, it is not present in the whole Git branch.
How can I delete it ?
This happened to me before. I just recreated the phantom object with the same name, associated it with the IR to be deleted, and then deleted the newly-recreated object (AzureSqlDatabaseContoso, in this case).
After that, ADF let me delete the underlying IR. Weird, but it worked for me.
the answer is what JeffRamos posted. Another option is to rename the file and 'name' field in git source and reload the adf and delete it there.
Source/linkedService/AzureKeyVault.json
rename this to
Source/linkedService/test.json
json content
{
"name": "AzureKeyVault",
"properties": {
"annotations": [],
"type": "AzureKeyVault",
"typeProperties": {
"baseUrl": "https://mykv.vault.azure.net/"
}
}
}
Rename "name" field
{
"name": "test",
"properties": {
"annotations": [],
"type": "AzureKeyVault",
"typeProperties": {
"baseUrl": "https://mykv.vault.azure.net/"
}
}
}

Tokenized Sublime Project Name

Is it possible in Sublime Text 3 to make a project have a name with tokens in it where the tokens would be parts of the path. I am trying to produce a name like the following.
${Product} (${Branch})
The branch would be the name of folder I added the to the project and the Product would be the name of the folder 1 level up from this so the path would look like this.
Products\\Product\\Branch
Here is an example of what I would think the project file would look like if these tokens existed or if there is a means for me to define them.
{
"folders":
[
{
"name": "${Product} (${Branch})",
"path": "Products\\Product1\\Branch"
},
{
"name": "${Product} (${Branch})",
"path": "Products\\Product2\\Branch"
}
...
]
}

Is there a way to use another extension instead of .feature?

I use some files written with Gherkin mode, but they don't have the ".feature" extension. I tried to change some visual code files related to cucumber extension to be able to highlight files that are not .feature but I had no success.
For example:
Workspace settings.json:
{
"folders": [
{
"path": "/home/user/git"
},
{
"path": "/home/user/Documents/scripts"
}
],
"settings": {}
"cucumberautocomplete.steps": [
"*.myext"
],
"cucumberautocomplete.syncfeatures": "*.myext",
"cucumberautocomplete.strictGherkinCompletion": true
}
It worked changing the file /home/user/.config/Code/User/settings.json and adding this config:
"files.associations": {
"*.myext": "feature"
}
{
"editor.renderWhitespace": "all",
"window.titleBarStyle": "custom",
"editor.fontSize": 15,
"python.jediEnabled": false,
"terminal.integrated.shell.linux": "/bin/bash",
"workbench.colorTheme": "Visual Studio Dark",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"[feature]": {
},
"files.associations": {
"*.myext": "feature"
}
}

Function highlighting with monokai in VS Code / Atom and Sublime

While running Sublime Text 3 and VS Code (or Atom) with the Monokai color theme, the Sublime Text syntax highlighting uses blue for function calls, such as in the example below
However, when I open the same code in VS Code using the monokai theme, functions are not painted blue
I would really like to change that, the code looks much better with function calls highlighted. However, I looked around the web and couldn't find how to change this behavior. Does anyone have any tips for that?
Thanks!
SEE UPDATE BELOW!
Seems like I've found a temporary solution. Go to this folder (if you are on Mac) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/theme-monokai/themes and put this code in monokai-color-theme.json file:
{
"name": "Function call",
"scope": "meta.function-call.generic",
"settings": {
"foreground": "#66d9efff"
}
},
Here is an example how it can look like:
screenshot
But keep in mind, that after theme update this changes may disappear!
UPDATE:
After having a couple more troubles with highlighting, I decided to upload the file with theme to GitHub and keep it up to date. So, if you don't want to dive into the code, just look in my repository: https://github.com/spyker77/monokai-theme-extended
UPDATE (April 2021)
It turns out that the previous solution is not sustainable. Therefore at the moment a better one could be:
In you Visual Studio Code go to "Code" => "Preferences" => "Color Theme" and pick Monokai;
Open settings.json file (how-to);
There will probably already be a bunch of settings in there, so all you need to do is just add the following customisations at the end and before the closing brace (don't forget a trailing comma after the last setting you continue):
"editor.tokenColorCustomizations": {
"[Monokai]": {
"textMateRules": [
{
"name": "Decorator definition decorator",
"scope": "punctuation.definition.decorator.python",
"settings": {
"foreground": "#F92672"
}
},
{
"name": "Meta function-call",
"scope": "meta.function-call.generic.python",
"settings": {
"foreground": "#66D9EF"
}
},
{
"name": "Storage type function async",
"scope": "storage.type.function.async.python",
"settings": {
"foreground": "#F92672",
}
},
{
"name": "Punctuation separator period",
"scope": "punctuation.separator.period.python",
"settings": {
"foreground": "#F8F8F2",
}
},
{
"name": "Entity name function decorator",
"scope": "entity.name.function.decorator.python",
"settings": {
"foreground": "#66D9EF",
}
},
{
"name": "Entity name type class",
"scope": "entity.name.type.class.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "Entity other inherited-class",
"scope": "entity.other.inherited-class.python",
"settings": {
"fontStyle": "italic"
}
},
{
"name": "Support type python",
"scope": "support.type.python",
"settings": {
"fontStyle": ""
}
},
{
"name": "String quoted docstring multi python",
"scope": "string.quoted.docstring.multi.python",
"settings": {
"foreground": "#88846F",
}
}
]
}
}
after trying for server hours finally found a solution and I came back to you to share the solution since I tried the answer above and couldn't make it work.
it turns out that the problem I with VScode extensions (python for Vscode), so disable that first,extension
then go to your setting.json file like that how to open setting
add this to the top of your file
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.function-call.generic",
"settings": {
"foreground":"#19D1E5"
}
}
]
},
and restart VScode and this should work, btw I am using monokai vibrent, and I am sure it will work in any theme you like.
setting.json
like this here
In settings.json:
"editor.tokenColorCustomizations": {
"[Monokai]": {
{
"scope": "entity.name.function",
"settings": {
"foreground": "#fdc306d0", // use your desired color
"fontStyle": "underline" // I like this, foreground color has some reduced opacity
}
}
}
}
might do the trick.

Resources