How can I make SublimeText show subdirs under folder_include_patterns? - sublimetext

I have a SublimeText3 project which I use to show particular folders in the sidebar. This works, however subdirectories of the folders in folder_include_pattern are not visible in the project (they're obviously there if I open the project as a folder instead).
node_modules
my-module
('test' should be here but is not shown)
my-other-module
('test' should be here but is not shown)
Here is my .project file:
{
"folders": [
{
"path": "node_modules",
"folder_include_patterns": [
"my-module",
"my-other-module"
]
},
{
"path": "."
}
]
}
How can I show all the subdirs of the directories in folder_include_patterns?

Solved it: subdir names must also be in folder_include_patterns. Eg, to include /node_modules/my-module/test, I needed:
{
"folders": [
{
"path": "node_modules",
"folder_include_patterns": [
"my-module",
"my-other-module",
"test"
]
},
{
"path": "."
}
]
}
2018 updae: note if you're reading this in 2018, and want to do this for node_modules, the best way to handle monorepos (where you have some of your own modules included in the project) is via yarn workspaces

Related

Change Serilog logging file path to a higher level directory

I am trying to change the location of where Serilog files get written to.
It will write to a directory at the root of the project or below (example, StructuredLogs/file-here.txt), but any time I attempt to use an env variable or write to an absolute file path or even relative file path, it will only write to the root directory and replace / or \ (properly escaped) with :
The settings are in the appSettings.json as such:
"Serilog": {
"Using": [],
"Properties": {
"ApplicationName": "Test API"
},
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Debug",
"Microsoft.TestApi": "Debug",
"System": "Debug"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithProcessName", "WithThreadId" ],
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "D:\\repo\\micro-services\\Apis\\structured-logs\\logs.txt",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:G} {Message}{NewLine:1}{Exception:1}"
}
},
{
"Name": "File",
"Args": {
"path": "D:\\repo\\micro-services\\Apis\\structured-logs\\logs.json",
"rollingInterval": "Day",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
...
I have tried:
Moving the solution to my local computer from a portable drive: C:/ vs D:/
Ensuring it was running with elevated permissions of Visual Studio 2022
changing to the various types of ways I could get to a different directory (relative, absolute, env variable, etc.)
forward-slash vs back-slash
none have worked.
Looks vaguely familiar to a character set encoding issue of some sort, but not sure.
Any thoughts as ideally I would have a relative path?
I use these at program.cs
the log file was saved at parent dictionary
Log.Logger = new LoggerConfiguration() .WriteTo.Console() .WriteTo.File("../log-.txt", rollingInterval: RollingInterval.Day) .CreateLogger();

Configure "Live Sass Compiler" (VSCode module)

I tried to configure the module "Live Sass Compiler" to put css files in an other directory than the one with scss files, but either I got errors, or it does nothing.
I made a directory/project to test it.
Root : C:\\test_space\\sass_compiler_config
Tree:
+ sass_compiler_config
+ build
+ src
+ modules
+ variables.scss
+ style.scss
Here is the test configuration I want to use to check it works:
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
I tried creating a directory named ".vscode" with a file "settings.json" inside and add it to the workspace.
I get this error : This setting can not be applied now. It is applied when you open this folder directly.
I tried putting it in the workspace configuration:
{
"folders": [
{
"path": "C:\\test_space\\.vscode"
},
{
"path": "C:\\test_space\\sass_compiler_config"
}
],
"settings": {
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
}
}
No error, but does nothing.
Could be that my paths are wrong.
As I guess;
You want to Save location in relative from workspace root or your Sass files, if so;
* Default value is null. (null means, it will generate CSS in the location of scss/sass. By The Way, It is null, NOT "null").
* "/" denotes relative to root.
* "~" denotes relative to every sass file. - Complex Scenario.
Please check the documentation
and this is the result
Go to path: C:\Users\your user\AppData\Roaming\Code\User\settings.json
and change there the "liveSassCompile.settings.formats" section
for example:
the parameter : "savePath": "/Python/CSS",

DocFX: Generate API documentation for multiple projects

I'm working on a project that has multiple projects in a solution. I would like to be able to generate the documentation from an outside directory to keep the application code folders clean. When I try to set the src directory in my docfx.json, it doesn't seem to like absolute paths, nor does it like relative paths.
{
"metadata":
[{
"src":
[{
"files": ["../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj"]
"exclude":
[
"**/obj/**",
"**/bin/**",
"_site/**"
]
}],
"dest": "api"
}],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"src": "../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices",
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"noLangKeyword": false
}
}
It says it built fine but didn't find any files and the directory that it searches for is staying in the current directory.
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern **/*.csproj, excluding
**/obj/**,**/bin/**,_site/**, under directory "D:\temp\WsiApiDocs\docfx_project"
Info: Completed executing in 54.0087 milliseconds.
Build succeeded.
0 Warning(s)
0 Error(s)
When I attempt to put the relative path in the files property, I get the following:
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern
../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj,
excluding **/obj/**,**/bin/**,_site/**, under directory
"D:\temp\WsiApiDocs\docfx_project"
**Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.**
Info: Completed executing in 48.9621 milliseconds.
Build succeeded with warning.
Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.
1 Warning(s)
0 Error(s)
So my confusion seems to be in how to use the src option instead. If use the src in metadata, then it seems that I can't specify the file and exclusion info. I tried to use a src property on the same level as metadata but that seemed to do nothing.
Just as the error states
../ is currently not supported in glob pattern
files, exclude etc. use glob patterns. Set a base directory instead via src:
{
"metadata": [
{
"src": [
{
"files": "Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**.csproj",
"exclude": [
"**/obj/**",
"**/bin/**"
],
"src": "../../.." // <---- base directory
}
],
"dest": "api"
}
],
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
}
// ...
]
}
Here is an exmaple of structuring multiple projects

How to generate documentation for other projects within solution using DocFx

I am using DocFx to automatically generate documentation in Visual Studio 2015.
Per the Getting Started instructions, I added an empty ASP.NET 4 Web Application and used the Nuget Console to install the DocFx build package (e.g. Install-Package docfx.msbuild). I built the site and it it generated documentation for code within the project.
I was wondering how to configure docfx.json to get DocFx to document code in other projects within the solution.
In docfx.json, there is an array of metadata. The example metadata has a src object with files and exclude properties.
To point to another project in your solution, add a cwd property to metadata and change folders (i.e. "../Another.Project").
{
"metadata": [
{
"src": [
{
"files": [ "**/*.csproj" ],
"exclude": [ "**/bin/**", "**/obj/**", "_site/**" ],
"cwd": "../Another.Project"
}
],
"dest": "obj/api"
}
],
"build": ...
}
This worked for me.
directory structure
+---ClassLibrary
| \---ClassLibrary.csproj
\---DocFxProject
\---docfx.json
docfx.json contents
cwd and src are synonyms for the same property
{
"metadata":
[
{
"src":
[
{
"files": [ "**/ClassLibrary.csproj" ],
"src": "..",
"exclude": [ "**/obj/**", "**/bin/**" ]
}
],
"dest": "obj/api"
}
],
"build": { ... }
}

Per-project Sublime Text 2 settings

My per-project Sublime Text 2 settings seem to not override the global settings.
I added this lines inside "settings" inside my myproj.sublime-project:
"file_exclude_patterns": ["config.xml"]
"folder_exclude_patterns": [".git", ".metadata"]
but that did not prevent those folders/files from showing up on the project sidebar.
None of the files/folders above are mentioned in my global settings.
Is it a known Sublime issue? Am I doing something wrong?
You have to add those settings under folders (example taken from here):
{
"folders":
[
{
"path": "src",
"folder_exclude_patterns": ["backup"]
},
{
"path": "docs",
"name": "Documentation",
"file_exclude_patterns": ["*.css"]
}
]
}

Resources