Sublime Text 3 - Different colour scheme for each workspace - sublimetext

Is it possible to specify a different colour scheme for each workspace in Sublime Text so that I can easily identify which one I'm working on? In my situation, I have a single project that branches into two duplicate workspaces; one for a client and one for in-house development. In other words, each workspace is an instance of the project directory.

You will have to save your workspace as a separate project.
Open up your .sublime-project file. (Top menu -> Project -> Edit project)
It will look similar to this:
{
"folders":
[
{
"follow_symlinks": true,
"path": "/home/user/some_path/project"
}
]
}
Simply add the color scheme setting:
{
"folders":
[
{
"follow_symlinks": true,
"path": "/home/user/some_path/project"
}
],
"settings":
{
"color_scheme": "Packages/Toxin Color Scheme/Toxin.tmTheme"
}
}
You can get the color scheme path by switching it as you normally do (e.g. from top menu) and opening your User Preferences.

Related

Hide + avoid loading specific files in visual studio code workspace

I have a Workspace navigating to bunch of directories that contains around 7000 files each.
How to hide all files of specific extension (and not load them, they are slowing PC extremely)?
so far:
"folders": [
{
"path": "directory1"
}
],
"settings": {
"files.exclude": {
"*.log": true,
"*.lib": true,
"*.sbr": true,
"*.bak": true,
"*.error": true
},
"files.associations": {
"*.tsl": "C++"
}
}
} ```
But I'm still seining all the files on the left side in workspace tab.

Is there a way to customize the color of the import in JS in VS Code?

I'm trying to change the color of the word after import in JS, in VS Code. I attached a screenshot of what I mean.
Screenshot:
What I'm referring to is underlined in red
I didn't find a valid entry in the textMateRules for this.
I'd appreciate some help. Thanks :)
I don't know which flavor of javascript you are using but you can use the following in your settings.json:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "variable.other.readwrite.alias.js",
"settings": {
"foreground": "#FF0000"
}
}
]
}
How to know which scopes a given token has
In your command palette type:
> Developer: Inspect Editor Tokens and Scopes
This will show a popup of information related to the token at cursor:
You will see applicable scope entries at the bottom for textmate scopes, you can use any of the options listed, but the topmost option is the most specfic option
If you use the Inspect Editor Tokens and Scopes command (from the Command Palette) you will see this scope:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "variable.other.readwrite.alias.js.jsx",
"settings": {
"foreground": "#ff0000",
"fontStyle": "bold underline"
}
},
]
},
You cannot add a colored underline without also changing the font color also.
If you really want to color the line differently than the text (and many other formatting options, see https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions
use the Highlight extension:
"highlight.regexes": {
"(import\\s+)(.*?)(\\s+from .*)": {
"filterLanguageRegex": "javascriptreact",
"decorations": [
{},
{
"borderWidth": "0 0 2px 0",
"borderColor": "red",
"borderStyle": "solid"
}
{}
]
}
},
LOL: you probably just wanted to change the word color, not the underlining. Nevertheless, the Highlight extension gives you many more options, like outlines, borders, backgroundColor, letterSpacing, even before and after css properties - so you can easily make the text you want to stand out.

A way to colorize the #regions in VS Code C#

I'm trying to get as comfortable as possible with this new IDE (coming from Visual Studio Community for Windows).
I used a very specific color theme that allowed me to understand the parts of the code at a glance. With VS Code though, it's more complicated for me as there aren't many options in the:
Settings > editor.tokenColorCustomizations.
Is there a way to colorize the #region pre-processor directives with a specific color?
Thanks.
Yes, it seems it has a distinct scope name (keyword.preprocessor.region), allowing you to target it with the setting, as the Developer: Show TM Scopes command shows:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "keyword.preprocessor.region.cs",
"settings": {
"foreground": "#FF0000"
}
},
{
"scope": "keyword.preprocessor.endregion.cs",
"settings": {
"foreground": "#FF0000"
}
}
]
}
It seems the scope includes neither the # nor the string though:

How to customize the color of custom syntax tokens in VSCode extension

TLDR; How can I have an extension colorize the syntax the extension is defining without it actually being a color theme the user has to enable?
I'm attempting to port this Sublime Text plugin (ToDone) to VSCode.
It creates a grammar for todo lists and then uses syntax highlighting to emphasize important tasks, mute completed tasks, etc.
I found "editor.tokenColorCustomizations", via Customize a Color Theme. It works with the new syntax when I use it in my user settings, but fails when I use it in the package.json#contributes portion of the extension manifest.
{
"contributes": {
"languages": [
{
"id": "todone",
"aliases": [
"ToDone",
"To-Done"
],
"extensions": [
".todone",
".todo"
]
}
],
"grammars": [
{
"language": "todone",
"scopeName": "text.todone",
"path": "./todone.tmLanguage"
}
],
"configurationDefaults": {
"[todone]": {
"editor.insertSpaces": false,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "symbol.definition.task-heading.todone",
"settings": {
"foreground": "#ff8800"
}
}
]
}
}
}
}
}
So far, the syntax seems ok — it's exactly what is being used by the Sublime plugin and the colors from the user-settings are applied correctly. Also, the format of the settings seems ok because "editor.insertSpaces" is being applied and the colors are working when present in the user-settings.
Lastly, I get a very disappointing 'Warning' 'Unknown editor configuration setting' message on the "editor.tokenColorCustomizations" setting in the extension package.json.
So, sounds like this setting is not enabled for extensions?
Another possible route I saw was to use decorators. But, I didn't see anything on inspecting the syntax tokens associated with a portion of text in the docs, e.g. some way to iterate through the syntax tokens of the document to apply decorators. So, the decorator route sounds like the hard-way compared to "editor.tokenColorCustomizations".
Any suggestions on how to make this work would be greatly appreciated.
Edit: The code, so far, is on GitHub: tiffon/vscode-todone
It only fails if you specify a specific language. It is working for me if I do not specify the todone extension.
"configurationDefaults": {
"editor.insertSpaces": false,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "symbol.definition.task-heading.todone",
"settings": {
"foreground": "#ff8800"
}
}
]
}
}

Force sublime text to use PATH from the shell value

I am trying to add a simple build system to sublime text 3. Here is my current project configuration :
{
"folders":
[
{
"path": "."
}
],
"settings":
{
},
"build_systems":
[
{
"path": "/opt/local/bin:/opt/local/sbin:/Applications/Cocos/tools/ant/bin:/Applications/Cocos/frameworks:/Applications/Cocos/frameworks/cocos2d-x-3.5/tools/cocos2d-console/bin:/Users/shadaen/.rbenv/shims:/Users/shadaen/.rbenv/bin:/usr/local/bin:./node_modules/.bin:/Users/shadaen/Library/Haskell/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/shadaen/.gem/ruby/1.8/bin:/opt/nginx/sbin:/Users/shadaen/.bash_it/plugins/available/todo",
"name": "HybrisHtml5",
"cmd" : ["./buildAndRunHtml5.sh"]
}
]
}
As you can see I have put a big path option which reflet the current state of my shell path. (echo $PATH)
My question is, is it possible to make sublime text use the current value of $PATH in is configuration ?
For information, I am under OSX Yosemite.
I find out that there is a plugin SublimeFixMacPath which fix the loaded path by sublime text.

Resources