Hide + avoid loading specific files in visual studio code workspace - visual-studio

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.

Related

Pre-populate image to FilePond input with `storeAsFile: true` option

I want to initiate FilePond with pre-populated images like this:
FilePond.create(inputElement, {
"storeAsFile": true,
"files": [
{
"source": "http://localhost/products/storage/main/dark.jpg",
"options": {"type":"local"}
}
]
});
But I got this error: Error during load. 400 (can't load URL)
I want to use FilePond in replace input file mode.
I can fix error by setting server load URL and it will load images properly but then when I want to upload new files it try to send files to server URL and don't consider "storeAsFile": true option.
Problem solved. I should use something like this:
FilePond.create(inputElement, {
"storeAsFile": true,
"server": {
"load": "http://localhost/products/storage/",
},
"files": [
{
"source": "main/dark.jpg",
"options": {"type":"local"}
}
]
});
and I shouldn't set any thing like server: {'url': 'anything', 'load': 'other url'} option.

GraphQL Query access all transformed json files within a folder located in subdirectories

I have a project structure like so:
-$PROJECT
--src
---data
----projects
-----project1
------project.json
------images
-------project1-preview.png
-----project2
------project.json
-------images
...
And so on, for however many projects. I could query these project.json files when they were named the title of the project and within a projects folder using allProjectsJson in graphQl, however now they are within subfolders within projects. I can only query them individually as allProject1Json and so on. Is there a way to query allProjectsJson so I get all the project.json files?
I can find my projects files by querying allFile with a filter for json files, however, these files are not transformed json so I can't access the elements.
In my gatsby-config file I am importing src/data as a source for files.
From my answer at https://github.com/gatsbyjs/gatsby/issues/20734:
Ahh, I see what you mean :)
luckily gatsby-transformer-json has a plugin option that will help get you unstuck!
It's the typeName option. You should be able to check for a field on each JSON node, and use that as the type name. Something like this:
{
resolve: `gatsby-transformer-json`,
options: {
typeName: ({ node, object, isArray }) =>
object.project ? `Project` : `Json`,
},
},
That way anything with the field project defined will show up as allProject { ... }, where any other json files will show up as allJson { ... }
{
allProject {
nodes {
project
}
}
}
{
"data": {
"allProject": {
"nodes": [
{
"project": "project1"
},
{
"project": "project2"
}
]
}
}
}
My project works very similarly. Here's how I have my gatsby-config.js setup:
module.exports = {
...
plugins: [
...,
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'project', // Identifier. Will then be queried as `allProjectsJson`
path: './data', // Source folder containing the JSON files
},
},
...,
]
};
Example JSON file:
[
{
"title": "Hello",
"description": "World",
"url": "https://www.google.com",
"image": "./images/img1.jpg"
},
{
"title": "World",
"description": "Hello",
"url": "https://www.google.com",
"image": "./images/img2.jpg"
},
]
Example query:
query projects {
allProjectsJson {
edges {
node {
id
title
description
url
image {
childImageSharp {
fluid {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
Hope this helps!

How can I force nrwl nx to respect tag updates?

When I update project tags in nx.json, TSLint seems unaware that the tags have changed, and lints and builds the project even though the dependencies are violated.
Example
Currently my nx.json file looks like
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
},
"utils": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
}
}
}
And my root tslint.json includes:
"nx-enforce-module-boundaries": [
true,
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:hep",
"onlyDependOnLibsWithTags": [
"scope:hep",
"scope:shared"
]
},
{
"sourceTag": "compatibility:ie10",
"onlyDependOnLibsWithTags": [
"compatibility:ie10"
]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": [
"scope:shared"
]
}
]
}
],
This passes linting as expected when I run ng lint hep.
However, if I edit the tags in nx.json, the linter does not show any errors. For example, if I modify nx.json to look like this (removing tags from the libraries), it still lints and builds without any errors.
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": [],
"implicitDependencies": []
},
"utils": {
"tags": [],
"implicitDependencies": []
}
}
}
If it's useful, when I update the rules in tslint.json, the linter DOES throw errors, but I would like it to also acknowledge changes to nx.json.
Is there a way I can get the linter to show errors when tags in nx.json are updated?
Nx caches a bunch of information concerning dependencies in generated file: /dist/nxdeps.json
You can simply delete this file to immediately see changes to nx.json.
It could also be VS Code's caching causing problems
You might need to restart the Typescript service before changes to tslint.json or tsconfig.json files go through.
ctrl + shift + p and then Typescript: Restart TS Server
In Webstorm, restarting the typescript service does not help but restarting IDE helps (looks like indexing files).
In my case, I am doing steps like this when editing nx.json:
Remove dir node_modules/.cache/nx
Run nx lint (will generate new cache)
Restart IDE

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"
}
}
]
}
}

Sublime Text 3 - Different colour scheme for each workspace

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.

Resources