hide certain hidden folders from my sublime project - sublimetext2

How do I hide certain hidden folders that are nested 3 folders deep from my sublime project.
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk"
},
{
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}

You need to edit your .sublime-project file like so:
{
"folders":
[
{
"path": "/C/Users/me/Desktop/files/siteFiles/happy site/trunk",
"folder_exclude_patterns": ["myHiddenFolder",".svn", "._d", ".metadata", ".settings"]
}
]
}
Save the file, and you should be all set. For more info on project settings, check out the docs.

Related

Editing Prettier options in Vscode

I need to enable .tpl files to be formatted like HTML by Prettier.
I've found on GitHub this block of code who should do it :
overrides: [
{
files: '*.html.tpl',
options: { parser: 'html' },
},
],
How should I implement it?
Go to File -> Preferences -> Settings.
In the search for box, search for "Associations" and then click on "Edit on settings.json".
Add the following to the JSON file:
"files.associations": {
"*.html.tpl": "html"
}
You have multiple options as of the syntax you want to use.
Here is an exemple in JSON:
//.prettierrc.json
{
"semi": false,
"overrides": [
{
"files": "*.html.tpl",
"options": { "parser": "html" },
},
],
}
You have more exemples on the documentation.

Angular 6 - How to stop generating spec files

In Angular 5 and earlier versions, to stop generating the spec files while generationg a component we had to add the following in .angular-cli.json file:
{
...
"defaults": {
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
in Angular 6+, following this link we have to add the next in the new angular.json file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"properties": {
....
"spec": {
"type": "boolean",
"description": "Specifies if a spec file is generated.",
"default": false
}
}
}
},
But when generating a new component a new spec file is still created, even after IDE restart, what is missing ?
You can set it in the angular-cli.json as
{
"defaults": {
"component": {
"spec": false
}
}
}
This will disable generating all spec files. If you want to disable on a specific component,
ng g c component-name --spec false
Thanks to the link provided here by G. Ross, the solution despite it doesn't match the official documentation of Angular 6 but it worked for me.
added the next in the "angular.json" file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"spec": false,
....
}
},
You can simply use to generate a component without its spec files ng g c NewComponent --spec=false

How to Debug other project than "main"?

Using Visual Studio Code, I have two directories in my workspace (both node.js projects), but I can only launch one of them. The launch.json file exists in both folders, but only the first is available in debug menu. The launch.json files looks like that:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\app.js",
"outFiles": [
"${workspaceFolder}/**/*.js"
]
}
]
}
How can I start debugging the second folder of my workspace?
I removed the first folder from the workspace, started the only project left, then added the removed folder again. Now I have both projects in the launch configurations.
I have found two solutions. Both involve editing your *.code-workspace file.
As OP found, you can reorder the folders. In the *.code-workspace file, place the folder with the desired launch.json at the top of the list of folders.
"folders": [
{
"path": "..\\ProjectWithLaunchJson"
},
{
"path": "..\\MyOtherProject"
}
]
Alternatively, you can include the launch configuration in the *.code-workspace file.
"folders": [
:
:
],
"settings": {
"launch": {
"configurations": [
{
<copy your launch.json's configuration into here>
}
]
}
}
YMMV. I had to tweak the path to the executable. And I had to remove the preLaunchTask property since VS Code could not find the Task. VS Code's support for this will likely evolve.

Composer package not showing up in autoload_namespaces

This should be an easy one. I developed a package call it MyVendor\MyPackage
inside MyVendor\MyPackage is:
MyVendor\MyPackage\composer.json
MyVendor\MyPackage\MyClass.php
The MyVendor\MyPackage\composer.json file contains:
{
"name":"MyVendor/MyPackage",
"description":"MyClass!!!",
"keywords": ["MyKeyword"],
"homepage": "http://MyPackage.com",
"type":"library",
"license": "MIT",
"authors": [
{
"name": "ME",
"email": "ME#ME.com",
"homepage":"http://ME.com"
}
],
"require": {
},
"autoload":{
"psr-4" : {
"MyVendor\\MyPackage\\":""
}
}
}
Now I have another project called MyOtherPackage whose composer.json file looks like:
{
"require": {
"monolog/monolog": "1.2.*",
"MyVendor/MyPackage": "1.0.0"
},
"autoload": {
"psr-4": {
"MyVendor\\MyOtherPackage\\": "MyOtherPackage/",
"MyVendor\\": "/"
}
},
"repositories": [
{
"type": "package",
"package": {
"name": "MyVendor/MyPackage",
"version": "1.0.0",
"source": {
"url": "https://ME.com/svn/MyVendor/MyPackage/",
"type": "svn",
"reference": "trunk"
}
}
}
]
}
So MyOtherPackage depends on MyPackage. Everything downloads just fine, but if I open up autload_namespaces.php it only includes monolog. It looks like this:
return array(
'Monolog' => array($vendorDir . '/monolog/monolog/src'),
);
Why isn't MyVendor/MyPackage appear in the namespaces.php or autoload_psr4.php file? Is the composer.json file wrong?
EDIT I added to the MyPackage composer.json file.
I've figured it out. It seems as if defining the repository as a package, I am telling composer that it isn't a composer compatible class, which means composer doesn't look for a composer.json file.
To fix it I removed the package definition and made the dependent class's composer.json file to look like:
{
"require": {
"monolog/monolog": "1.2.*",
"MyVendor/MyPackage": "1.0.0"
},
"autoload": {
"psr-4": {
"MyVendor\\MyOtherPackage\\": "MyOtherPackage/",
"MyVendor\\": "/"
}
},
"repositories": [
{
"type": "svn",
"url": "https://ME.com/svn/MyVendor/MyPackage/",
"reference": "tags"
}
]
}
This tells composer to download the package from this repository and look for the composer.json file.
You did not define any autoload mechanism in your first package. If you don't, Composer cannot know how to autoload the classes, and does nothing (which is a valid option if your package does not contain any PHP at all, but for example only images and javascript).
Add something like this:
"autoload": {
"psr-0": {
"MyVendor\\Namespace":"src/path"
}
}

folder path in sublime text build system

My sublime project looks like this:
{
"folders":
[
{
"folder_exclude_patterns":
[
".bzr",
"build",
"webapps",
"work",
".settings"
],
"path": "/home/charles/project/Editor/trunk"
}
],
"settings":
{
"build_on_save": true,
"filename_filter": "\\.(java)$",
"tab_size": 4,
"translate_tabs_to_spaces": false
},
"build_systems":
[
{
"name": "compile",
"cmd": ["ant", "-f", "dev.xml", "compile"]
}
]
}
When I save a file the console says:
Buildfile: dev.xml does not exist!
Build failed
[Finished in 0.2s with exit code 1]
I know that I need to put something before dev.xml but I don't know what.
I found some possibilities here: http://sublimetext.info/docs/en/reference/build_systems.html#variables
But What I need is the folder path "/home/charles/project/Editor/trunk" in my case...
Any idea how I can achieve this?
You are missing "working_dir" in your "build_systems" setup. The example below will use the directory that holds the sublime project file as the build starting directory.
"build_systems":
[
{
"name": "compile",
"working_dir": "${project_path}",
"cmd": ["ant", "-f", "dev.xml", "compile"]
}
]
More information can be found at: http://www.sublimetext.com/docs/2/projects.html