Fix toggle comment functionality for batch files in Sublime Text - batch-file

I must be having a bad search day, but I can't find any information about how to customize Sublime Text 2 so that toggle comment works correctly for windows batch files (i.e. adding either a REM or :: to the beginning of a line). Any help?

You can create a plugin or a macro to do it. Perhaps a snippet already exists but i have not found it.
I will try to explain the "create macro" alternative.
Create a macro with this code (save it in Packages/User, with name what-you-want.sublime-macro):
[
{"command": "split_selection_into_lines"},
{"command": "move_to", "args": {"to": "hardbol", "extend": false}},
{"command": "insert", "args": {"characters": "REM "}}
]
Now you can use it. Select the lines to comment and execute the macro.
You can also bind the macro to a key. Add in "Key Bindings - User" this key binding:
{ "keys": ["alt+."], "command": "run_macro_file",
"args": {"file": "Packages/User/what-you-want.sublime-macro"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.dosbatch" }
]
}
The "selector" key in the "context" ensures that this key is only mapped when in batch files ("source.dosbatch").
References:
Banish Repetitive Tasks with Sublime Text 2 Macros
Key binding context to only react on e.g. Python code

Related

Visual Studio 2019 debug embedded targets. How to force VS to not treat it as a windows executable

I am trying to set up Cmake ARM uC (STM32) embedded project in the VS 2019.
Project buils OK but I struggle to start the debug session.
I have amended launch.vs.json
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "cppdbg",
"name": "GCEC-FW.elf",
"project": "out\\build\\IoT-Debug\\GCEC-FW.elf",
"projectTarget": "",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}\\BUILD\\${workspaceRootFolderName}.elf",
"MIMode": "gdb",
"externalConsole": true,
"inheritEnvironments": [
"gcc_arm"
],
"miDebuggerPath": "${env.gccpath}\\bin\\arm-none-eabi-gdb.exe",
"setupCommands": [
{
"text": "-environment-cd ${workspaceRoot}/BUILD"
},
{
"text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf",
"description": "load file",
"ignoreFailures": false
},
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"visualizerFile": "${debugInfo.linuxNatvisPath}",
"showDisplayString": true,
"miDebuggerServerAddress": "localhost:3333",
"launchCompleteCommand": "None",
"debugServerPath": "C:\\Program Files (x86)\Atollic\\TrueSTUDIO for STM32 9.3.0\\Servers\\J-Link_gdbserver\\JLinkGDBServerCL.exe",
"debugServerArgs": "-port 2331 -s -CPU Cortex-M -device STM32F427II -endian little -speed 4000 -vd -swoport 2332",
"serverStarted": "GDB\\ server\\ started",
"filterStderr": true,
"filterStdout": true
}
]
}
But when I try to start the debug session I am getting error stating that my .elf file is not an win32 executable (which is actually correct - it is not).
The question is: what has to be done VS to start this session?
edit
I needed to change the name when adding appending the new microcontroller debug configuration.
"name": "GCEC-FW.elf"
Now it complains about the path to the gdb.
The new question is: can I output or see build variables in VisualStudio - Like
${workspaceRootFolderName} or ${env.gccpath}
Regarding "... can I output or see build variables in VisualStudio - Like: ${workspaceRootFolderName} or ${env.gccpath}
To display all of the currently available macros, in the Property
Pages dialog, under VC++ Directories, choose the drop-down arrow at
the end of a property row. Click on Edit and then in the edit dialog
box, choose the Macros button. The current set of properties and
macros visible to Visual Studio is listed along with the current value
for each. For more information, see the Specifying User-Defined Values
section of C++ project property page reference.
More here about that.

How to enable perfect and full intellisense for specific functions in visual studio code

In the visual studio code, as soon as I type the pr ... it shows me printf and soon as I hit enter it just writes printf as a normal variable but it doesn't auto complete like printf("").
Can you please help me to how to add this auto complete feature in visual studio code windows edition.
I figured out a way, and this worked for me.
Try doing this:
Go to File > Preferences > User Snippets, type in (c.json)
There you can create your own snippets. For example :
"printf": {
"prefix": "print",
"body": ["printf(\"$1\",$2);", "$3"],
"description": "Printf statement"
},
"include": {
"prefix": "include",
"body": ["#include<$1>", "$2"],
"description": "Include Statement"
}
You will even find the instructions in the c.json file in the form of comments, follow them and customize the way you want, and you are set ready.
Thank You :)

How to pass the output of one ARM template to the input parameter of the next ARM template in Continuous Deployment using VSTS?

I have a ServiceBuswithQueue ARM template that has the output section like this below:
"outputs": {
"serviceBusNamespaceName": {
"type": "string",
"value": "[parameters('serviceBusNamespaceName')]"
},
"namespaceConnectionString": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]"
},
"sharedAccessPolicyPrimaryKey": {
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryKey]"
},
"serviceBusQueueName": {
"type": "string",
"value": "[parameters('serviceBusQueueName')]"
}
}
For that I Created the Continuous Integration (CI) and Continuous Deployment (CD) in VSTS, In CD I have used the PowerShell task to deploy the above ARM template. But I want to pass the output of this ARM template like "$(serviceBusQueueName)" to input parameter of the next ARM template in Continuous Deployment.
In know the above scenario can achieved using ARM outputs in between the two ARM task in Continuous Deployment. But I don’t want it because currently I am using the PowerShell task to deploy the ARM template.
Before posting this question, I was researched and find the following links but those are not helpful to resolve my issue.
Azure ARM templates - using the output of other deployments
How do I use ARM 'outputs' values another release task?
Can anyone please suggest me how to resolve the above issue?
You can override parameters by specifying corresponding parameters.
Override template parameter in the script
# Start the deployment
Write-Host "Starting deployment...";
$outputs = New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Mode Incremental -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
foreach ($key in $outputs.Outputs.Keys){
$type = $outputs.Outputs.Item($key).Type
$value = $outputs.Outputs.Item($key).Value
Write-Host "##vso[task.setvariable variable=$key;]$value"
}
You can display all the environment variables in a subsequent script:
Write-Host "Environment variables:"
gci env:* | sort-object name

Babel Snippets for ReactJS not working in sublime text

I edited my key bindings because the only trigger that would work inside the editor is when I type rcc. Was hoping that when I type cdm, it will work. This is the package I installed - https://github.com/babel/babel-sublime-snippets
{
"keys": ["ctrl+shift+,"],
"command": "insert_snippet",
"args": {
"name": "Packages/Babel Snippets/react_wrap.sublime-snippet"
}
}
to this
{
"keys": ["ctrl+shift+,"],
"command": "insert_snippet",
"args": {
"name": "Packages/Babel Snippets/react_componentDidMount_(class).sublime-snippet"
}
}
For people who will encounter this in the future. I got it working. Part of the problem that confused me was that there was no documentation on what and how to add a snippet. There was an instruction for adding a keybinding for react_wrap. Normally when we see tons of snippet files, we would do the same thing, add config for each files.
I really didn't have to add the react_componentDidMount_(class).sublime-snippet. I was told to type cdm inside the class and it worked.
Make sure the current language selected is not javascript but javascript(Babel). If you don't have it, just install it from package manager. It's available by the name of Babel
Also you can set it the default language for some extensions like .jsx.

Sencha SDK Tool / JSBuilder - include all files with *

Using Sencha Touch 1, I am having to manually create my app.jsb3 file (and add all linked JavaScript files to that .jsb3 file) in order to use jsbuilder to minify all files.
Anybody know the correct syntax to allow use of a wildcard (.*) (referred to as a Filter) in order to easily include all files in a folder?
I know the docs here: http://dev.sencha.com/deploy/JSBuilder2/JSB2FileFormat.txt
state that ".*" can be used - but I've had no joy:
"files": [
{"path": "views/", "name": "file1.js"},
{"path": "views/", "name": "file2.js"}, // currently manually adding each file
...
{"path": "views/", "name": ".*"}, // include all?
{"path": "views/.*"}, // include all?
]
The docs only show filters in relation to listing resources, but not also for listing files - may be why!

Resources