Sublime Text project folders : display path as name - sublimetext

I have a Sublime Text project with several folders. My problem is that these folders have the same name (the name of my app). So the folder name in the sidebar is not obvious.
For example, given a "helloworld" app :
d:\repos\helloworld is my Git repository for the app.
d:\temp\helloworld is a temporary folder where I extract jar files to search about a class or work on images.
d:\help\helloworld is where I put some useful files like Unix commands or SQL scripts that I use to debug my app. (I share other ones in the Git repo, but these ones are private.)
So my ST sidebar is :
Folders
├─ helloworld
├─ helloworld
└─ helloworld
I know I can change my ST project file to add a name. This is what I do now:
"folders": [ {
"path": "D:\\temp\\helloworld",
"name": "D:\\temp\\helloworld"
} ]
What I want to do is something like:
"folders": [ {
"path": "D:\\temp\\helloworld",
"name": ${path}
} ]
Or with a user setting like:
"use_path_as_name_in_sidebar" : true

As of today (Sublime Text 3 Build 3059), Sublime Text's project does not support such feature.
http://www.sublimetext.com/docs/3/projects.html
Sublime Text's forum may be a better place for such feature request.

This is possible now, and quite easy. As per Sublime Documentation: just edit your .project file thus:
{
"folders":
[
{
"path": "./path/to/your/docs",
"name": "Documentation"
}
]
}

Related

Download files from Artifactory to Teamcity without retaining their full path

I am using
TeamCity Enterprise 2017.1.2 (build 46812)
Artifactory Professional 5.3.1 rev 50046
Teamcity has the Artifactory plug-in installed (ver 2.3.0)
The task is simple - download files from Artifactory to Teamcity build:
From Artifactory MyRepo/RootFolder/ProjectFolder/1.2.3/<files>
To TC %checkoutdir%/artifacts/<files>
The <files> part of the path contains both folders and files and I want to retain their structure.
The download spec json is:
{
"files": [
{
"pattern": "MyRepo/RootFolder/ProjectFolder/1.2.3/",
"target": "artifacts/"
}
]
}
However, the files get downloaded into a different location than I would expect:
Actual: artifacts/RootFolder/ProjectFolder/1.2.3/<files>
Expected: artifacts/<files>
The whole path from Artifactory gets appended after the target directory. How do I tell the plugin to only use the relative path of files after the specified root? I have tried fiddling about with wildcards, slashes etc, but nothing helped.
I had to create an extra build step where I manually move files to the structure I expect, but I would prefer not to have to do that.
WORKING ANSWER:
{
"files": [
{
"pattern": "MyRepo/RootFolder/ProjectFolder/1.2.3/(*)",
"target": "artifacts/{1}",
"flat": "true"
}
]
}
You can customize your target structure by using Placeholders in your File Specs as described here.
Placeholders allow you to capture a specific section of your File Spec "pattern" property value, and use it inside the "target" property value.
In your case, the download File Spec should look like this:
{
"files": [
{
"pattern": "MyRepo/RootFolder/ProjectFolder/1.2.3/(*)",
"target": "artifacts/{1}"
}
]
}

Exclude .js, include .min.js when publishing to Azure with VS 2015

I found this (seemingly) related SO post, but following the suggestions from both answers didn't help, all my js files are getting pushed to Azure (not just the *.min.js files from my js folder.)
What am I doing wrong? Is this possible? I could update my gulp script I suppose to read an environment variable ("Development", or "Production") and then delete the source js files conditionally. It just seems to be better to make the build task function as I wish (especially since it looks doable.)
Js files for my project are in [solution folder][project folder]\wwwroot\js.
According to the comment you added in the related SO post you mentioned, I assumed that your application is Based on ASP.NET Core. As far as I know, we could determine that which file/folder could be included or excluded when publishing your web application by configuring the publishOptions section in your project.json file as follows:
"publishOptions": {
"include": [
"wwwroot",
"wwwroot/js/**/*.min.js",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
],
"exclude": [
"wwwroot/js/**/*.js"
]
}
But, as this tutorial mentioned that the exclude patterns have higher priority than the include patterns, hence a file found in both will be excluded. In this situation, you need to configure all the included/excluded files in the includeFiles/excludeFiles node of the publishOptions.
According to your requirement, Using Gulp would be an ideal approach to achieve it.
Additionally, if your project is an ASP.NET MVC application, you could add the following to your .pubxml file.
<ItemGroup>
<ExcludeFromPackageFiles Include="wwwroot\js\**\*.js" Exclude="wwwroot\js\**\*.min.js">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
I ended up going the gulp route thus far (still interested in the other alternatives if viable.)
Created a new task in my gulpfile...
var del = require("del");
gulp.task("remove-non-minjs", function () {
return del([
paths.scripts.dest + "**/*.js",
"!" + paths.scripts.dest + "**/*.min.js"
]);
});
And then added this to my project.json's prepublish script...
"scripts": {
"prebuild": [ "gulp default" ],
"prepublish": [ "npm install", "gulp default", "gulp remove-non-minjs" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
I verified it works, but just seems a bit hacky.
This seemed to do the trick for me:
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/advanced-enterprise-web-deployment/excluding-files-and-folders-from-deployment
Via the Solution Explorer, you can edit the Properties of each file in your project and set the Build Action to NONE. It looks like you might be able to select multiple files at one time while doing this.

Global.json and running web application

I am trying to create a new web application using OS X and VS Code from scratch without using any scaffolding tool. My starting point is Scott Allen's tutorial on pluralsight:
https://app.pluralsight.com/library/courses/aspdotnet-core-1-0-fundamentals/table-of-contents
My project structure is:
The global.json file contains
{
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-rc1-update2"
}
}
And the project.json currently contains
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": false
},
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000"
},
"exclude": [
"wwwroot",
"node_modules"
]
}
I have run dnu restore to get the packages and now I would like to run the web. I need to go to the web app folder and run dnx web in order to do so and the app starts
Is it possible to run the application directly from the root folder, not from the web app folder? Is the global.json file needed in such setup? And how do I change the hosting environment? I have gone through the documentation, but the hosting environment is only clear when using VS 2015.
You cannot simply run from the root because there could be multiple projects that are "executable". But you can pass the project to dnx using the --project/-p argument.
The environment is set using the ASPNET_ENVIRONMENT environment variable.
The global.json file is useful for two things:
The sdk section is only by VS.
The projects section is used all the time and it's useful if you have the projects in multiple folders (for example src and test). If everything is in a single folder, you don't need it.
So, the bare minimum in order to run an web application is:
A folder for your project
A project.json file
A startup file

how to write package for sublimeREPL

The SublimeREPL plugin for ST supports lots of languages, but not all of them. It also supports writing your own configuration file for any non-default languages. Once you've written this configuration, is there any way to include it in a regular Sublime Text plugin so that when installed along with SublimeREPL it will work and support the desired language?
This turned out not to be so bad. What I wanted was to be able to distribute files in a package that would work with SublimeREPL without the user moving the files. All of the tutorials I found involved having the user place command and menu files in the SublimeREPL package directory.
Sublime Text doesn't care where it finds configuration files; they're all loaded no matter where in the packages directory they are found. Main.sublime-menu adds to the main menu and *.sublime-commands add commands.
First, fill in and rename Main.sublime-menu.template. Then do a Default.sublime-commands as well (couldn't find a template):
[
{
"caption": "SublimeREPL: XYZ Console",
"command": "run_existing_window_command", "args":
{
"id": "repl_xyz",
"file": "../XYZ-package/Main.sublime-menu"
}
}
]
The thing that was confusing me was how to refer to the menu file from the commands file, but it's simple; SublimeREPL uses the SublimeREPL as the working directory, so simply make a path from there to the menu file in your own package: ../XYZ-package/Main.sublime-menu.
Add these completed files to your package and they will work just fine with SublimeREPL.

Compiling typescript files into one file, but some of them as single files

I have a project with lots of Typescript files, which I want to compile into one file.
I can set that up in Visual Studio, no problem.
But then I also have some files that should be compiled in their own file.
Basically, I have a structure like this:
js/
tests/
Everything in js/ should be compiled into one file, everything in tests/ should be each an individual file.
I could now compile into individual files, and use a bundle with Webessentials, but this is not so good to debug.
Is there a way to tell the Typescript compiler to have different compile settings for different folders?
I'd also really like to still have it compile on saving a file.
No, you would have to run the compiler with different arguments for each folder. Since you're using Visual Studio, you could do that by creating a separate project that includes the files under the /tests folder.
Update on this:
#curpa answer back then was the correct one, but since then, some updates have been added to Typescript.
Since, I think Typescript 1.8 (not quite sure?), you can use tsconfig files to configure typescript configuration. You can add those files into different folders, and the typescript compiler will then transpile the files according to the tsconfig in the same folder, or one of its parent folders.
With this, you can then configure your project to transpile with different settings in different folders.
In my example, with folders js/ and tests/, this might look like this:
tsconfig.json in js/
{
"compilerOptions": {
...
"outFile": "../../built/local/tsc.js"
},
"include": [
"**/*"
]
}
tsconfig.json in tests/
{
"compilerOptions": {
...
// not outfile specified, ts files will be transpiled in
// a js file, for each
},
"include": [
"**/*"
]
}

Resources