Need help editing "Preferences.sublime-settings - User" - json

Ok... I'm very new, so please be nice :)
I'm trying to change the cursor, but I don't know how to add the "cursor code" to the "theme code" (monokai pro). The "theme code" is below "cursor code", how do I use both successfully? All I want to do is change the cursor.
How do I add this code (cursor code)
{
"caret_extra_width": 5,
"caret_style": "solid",
"wide_caret": true
}
To this code (theme code)
{
"author": "Chris Kempson",
"color_scheme": "Packages/Theme - Monokai Pro/Monokai Pro.sublime-color-scheme",
"globals":
{
"background": "var(blue5)",
"caret": "var(white)",
"foreground": "var(white)",
"invisibles": "var(blue7)",
"line_highlight": "var(blue)",
"selection": "var(blue2)"
},
"ignored_packages":
[
"Vintage"
],
"name": "Tomorrow Night - Blue",
"rules":
[
{
"foreground": "var(grey)",
"name": "Comment",
"scope": "comment, string.quoted.double.block.python"
},
{
"foreground": "var(white)",
"name": "Foreground, Operator",
"scope": "keyword.operator.class, keyword.operator, constant.other, source.php.embedded.line"
},
{
"foreground": "var(red3)",
"name": "Variable, String Link, Regular Expression, Tag Name",
"scope": "variable, support.other.variable, string.other.link, string.regexp, entity.name.tag, entity.other.attribute-name, meta.tag, declaration.tag"
},
{
"foreground": "var(orange)",
"name": "Number, Constant, Function Argument, Tag Attribute, Embedded",
"scope": "constant.numeric, constant.language, support.constant, constant.character, variable.parameter, punctuation.section.embedded, keyword.other.unit"
},
{
"foreground": "var(orange2)",
"name": "Class, Support",
"scope": "entity.name.class, entity.name.type.class, support.type, support.class"
},
{
"foreground": "var(green)",
"name": "String, Symbols, Inherited Class, Markup Heading",
"scope": "string, constant.other.symbol, entity.other.inherited-class, markup.heading"
},
{
"foreground": "var(blue6)",
"name": "Operator, Misc",
"scope": "keyword.operator, constant.other.color"
},
{
"foreground": "var(white3)",
"name": "Function, Special Method, Block Level",
"scope": "entity.name.function, meta.function-call, support.function, keyword.other.special-method, meta.block-level"
},
{
"foreground": "var(white2)",
"name": "Keyword, Storage",
"scope": "keyword, storage, storage.type, entity.name.tag.css"
},
{
"background": "var(red2)",
"foreground": "var(white)",
"name": "Invalid",
"scope": "invalid"
},
{
"background": "var(white4)",
"foreground": "var(white)",
"name": "Separator",
"scope": "meta.separator"
},
{
"background": "var(white2)",
"foreground": "var(white)",
"name": "Deprecated",
"scope": "invalid.deprecated"
},
{
"foreground": "var(white)",
"name": "Diff foreground",
"scope": "markup.inserted.diff, markup.deleted.diff, meta.diff.header.to-file, meta.diff.header.from-file"
},
{
"foreground": "var(yellow)",
"name": "Diff insertion",
"scope": "markup.inserted.diff, meta.diff.header.to-file"
},
{
"foreground": "var(red)",
"name": "Diff deletion",
"scope": "markup.deleted.diff, meta.diff.header.from-file"
},
{
"background": "var(blue4)",
"foreground": "var(white)",
"name": "Diff header",
"scope": "meta.diff.header.from-file, meta.diff.header.to-file"
},
{
"font_style": "italic",
"foreground": "var(blue3)",
"name": "Diff range",
"scope": "meta.diff.range"
},
{
"foreground": "var(red4)",
"name": "diff.deleted",
"scope": "markup.deleted"
},
{
"foreground": "var(yellow2)",
"name": "diff.inserted",
"scope": "markup.inserted"
},
{
"foreground": "var(purple)",
"name": "diff.changed",
"scope": "markup.changed"
}
],
"theme": "Agila.sublime-theme",
"variables":
{
"blue": "#00346e",
"blue2": "#003f8e",
"blue3": "#3e999f",
"blue4": "#4271ae",
"blue5": "#002451",
"blue6": "#99ffff",
"blue7": "#404f7d",
"green": "#d1f1a9",
"grey": "#999999",
"orange": "#ffc58f",
"orange2": "#ffeead",
"purple": "#967efb",
"red": "#c82829",
"red2": "#f99da5",
"red3": "#ff9da4",
"red4": "#f92672",
"white": "#ffffff",
"white2": "#ebbbff",
"white3": "#bbdaff",
"white4": "#bbdafe",
"yellow": "#718c00",
"yellow2": "#a6e22e"
}
}
Without getting this error message:
Error trying to parse settings: Unexpected trailing characters in
Packages/User/Preferences.sublime-settings
Thank you guys!

What you are calling your "cursor code" is actually some preferences. They should be added to your user preferences (available via Preferences → Settings on the right side). Don't erase what's already there, just follow the rules of JSON - start with an opening curly brace { on one line, then have one preference per line with a comma , at the end of each line, then close with a curly brace }. You can have as many preferences set as you want, don't limit it to just those three. Look at the default preferences on the left for a list of every single one that's available. Don't worry if you don't understand what they all mean - you can customize just about every single thing about Sublime!
As far as the color scheme, which is kind of what your lower piece of code is - the easiest thing to do is to install Monokai Pro from Package Control and ignore that code completely - it's corrupted. If you haven't installed Package Control yet, install it by selecting Tools → Install Package Control…. Once that's done, hit CtrlShiftP on Windows/Linux, ⌘ShiftP on macOS, to open the Command Palette. Type in pci (short for Package Control: Install Package), hit Enter, type in monpro, select Theme - Monokai Pro, and hit Enter again. You may see a message on the status bar (down at the very bottom of the window) saying it's installing.
Once it installs, select Preferences → Color Scheme…, scroll through the list of options, click on Monokai Pro, hit Enter, and you should be good to go. I know it looks a little complicated, but in reality it's not. Once Package Control is installed, you don't have to install it again (in fact - you can't install it again). You should also learn through this exercise that all Sublime modal menus have fuzzy search, so you can usually just type a couple of letters and the option you want will pop right up.

Related

how do i get rid of the json errors : line 2-4 Comments are not permitted in JSON. line 62 char 2 end of file expected

i am working on learning more about json code and how to get rid of the json errors and i am just working from the script i would like to make a better script. i did do everything i could think of to get rid of the errors without changing the language in visual studios, what is your solution to get rid of the errors?
here are the error message in visual studio:
line 2-4 Comments are not permitted in JSON.
line 62 char 2 end of file expected
the following json script is used to make the c++ debugger run and is used to enable visual studio to identifiy c++ errors. i am just tweaking it.
{
line 2 // Use IntelliSense to learn about possible attributes.
line 3 // Hover to view descriptions of existing attributes.
line 4 // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "enter program name, for example ${workspaceFolder}/a.exe",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"miDebuggerPath": "/path/to/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"customLaunchSetupCommands": [
{ "text": "target-run", "description": "run target", "ignoreFailures": false }
],
"launchCompleteCommand": "exec-run",
"windows :gdb"
:"C:\\MinGw\\bin\\gdb.exe"
}
]
,"name": "(gdb) Bash on Windows Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"pipeTransport": {
"debuggerPath": "/usr/bin/gdb",
"pipeProgram": "${env:windir}\\system32\\bash.exe",
"pipeArgs": ["-c"],
"pipeCwd": ""
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
[enter image description here][1] ],"customLaunchSetupCommands": [
{ "text": "target-run", "description": "run target", "ignoreFailures": false }
],
"launchCompleteCommand": "exec-run",
"windows" : "gdb,"
,"miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
line 62 }[
]
to get rid of the line 2-4 Comments are not permitted in JSON. remove a backslash on 2 of those lines and a colon. remove the brackets at line 62.

Hello World sample: "Something went wrong" when installing/testing

I tried to get the example from https://learn.microsoft.com/en-us/microsoftteams/platform/get-started/get-started-dotnet to run.
I successfully built and published (on Azure) the webapp.
Then I tried
- manually editing the json file in the visual studio solution similarly to what the docs said, and then import the resulting zip in App Studio
- adding the App directly in App Studio through the manifest editor (this works, but it fails when installing/testing it)
Both give me an error without any more info "something went wrong".
Any way to actually figure out what I did wrong (if anything)?
Either way, maybe you guys can figure it out from the json file's contents:
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.0/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.0",
"version": "1.0.0",
"id": " 1CC58D17-1E95-443C-958F-E1F14D4CA3B4",
"packageName": "com.contoso.helloworld",
"developer": {
"name": "Contoso",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com/privacy",
"termsOfUseUrl": "https://www.microsoft.com/termsofuse"
},
"name": {
"short": "Hello World",
"full": "Hello World App for Microsoft Teams"
},
"description": {
"short": "Hello World App for Microsoft Teams",
"full": "This sample app provides a very simple app for Microsoft Teams. You can extend this to add more content and capabilities."
},
"icons": {
"outline": "contoso20x20.png",
"color": "contoso96x96.png"
},
"accentColor": "#60A18E",
"staticTabs": [
{
"entityId": "com.contoso.helloworld.hellotab",
"name": "Hello Tab",
"contentUrl": "https://microsoftteamssampleshelloworldweb20181022032046.azurewebsites.net/hello",
"scopes": [
"personal"
]
}
],
"configurableTabs": [
{
"configurationUrl": "https://microsoftteamssampleshelloworldweb20181022032046.azurewebsites.net/configure",
"canUpdateConfiguration": true,
"scopes": [
"team"
]
}
],
"bots": [
{
"botId": "00000000-0000-0000-0000-000000000000",
"needsChannelSelector": false,
"isNotificationOnly": false,
"scopes": [
"team",
"personal"
]
}
],
"composeExtensions": [
{
"botId": "00000000-0000-0000-0000-000000000000",
"scopes": [
"personal",
"team"
],
"commands": [
{
"id": "getRandomText",
"description": "Gets some random text and images that you can insert in messages for fun.",
"title": "Get some random text for fun",
"initialRun": true,
"parameters": [
{
"name": "cardTitle",
"description": "Card title to use",
"title": "Card title"
}
]
}
]
}
],
"permissions": [],
"validDomains": []
}
Any suggestions?
There is a whitespace in your app Id in shared manifes:
"id": " 1CC58D17-1E95-443C-958F-E1F14D4CA3B4"
Could you please remove it and try and let us know if it works? Also you can remove bots and composeExtensions section if you want.
I can't comment yet (not enough reputation points) but could you go through the instructions again?
I believe something went wrong with either the GUID, or one of the URL's. The instructions also advise to use ngrok, which is usefull for debugging.
If you can't find a clear error message, i advise you follow those instructions.

Visual Studio Code: Comments not being detected while trying to add support for a new language/filetype

So I am working on a research project that involves using a very specific piece of software that uses its own filetype; XPPAUT using .ode files. To prevent me and my team of not-neuroscientists from ripping our hair out trying to work with this, I decided to write a syntax highlighter for these .ode files.
To start I just wanted to be able to recognize and color linecomments, which are delineated with a #, similar to Python, however when I run the development environment, the comments are not highlighted with the color I set my dev workspace to use, or highlighted at all. I'm very new to this, so any help would be appreciated.
Here is my package.json file
{
"name": "ode",
"displayName": "XPP ODE",
"description": "ODE files to be used with XPP/XPPAUT",
"version": "0.0.1",
"publisher": "wjmccann",
"engines": {
"vscode": "^1.22.0"
},
"categories": [
"Languages"
],
"contributes": {
"languages": [{
"id": "xpp",
"aliases": ["XPP ODE", "XPP", "XPPAUT"],
"extensions": [".ode"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "xpp",
"scopeName": "source.xpp",
"path": "./syntaxes/xpp.tmLanguage.json"
}]
}
}
and the corresponding language-configuration.json
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "#",
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
The language-configuration.json file defines text patterns used in a variety of standard features of VS Code such as comment toggling as described here.
Syntax highlighting/colouring is via the grammars contribution point in package.json as described here.
Based on your package.jsonyou will need to create a new file at ./syntaxes/xpp.tmLanguage.json with the following content for your comments to be coloured appropriately. The actual colour used will depend on your current theme.
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "xpp",
"scopeName": "source.xpp",
"patterns": [
{
"include": "#comments"
}
],
"repository": {
"comments": {
"patterns": [{
"name": "comment.line.number-sign.xpp",
"match": "#.*"
}]
}
}
}

How to check if name already exists? Azure Ressource Manager Template

is it possible to check, in an ARM Template, if the name for my Virtual Machine already exists?
I am developing a Solution Template for the Azure Marketplace. Maybe it is possible to set a paramter in the UiDefinition uniqe?
The goal is to reproduce this green Hook
A couple notes...
VM Names only need to be unique within a resourceGroup, not within the subscription
Solution Templates must be deployed to empty resourceGroups, so collisions with existing resources aren't possible
For solution templates the preference is that you simply name the VMs for the user, rather than asking - use something that is appropriate for the workload (e.g. jumpbox) - not all solutions do this but we're trying to improve that experience
Given that it's not likely we'll ever build a control that checks for naming collisions on resources without globally unique constraints.
That help?
This looks impossible, according to the documentation.
There are no validation scenarious.
I assume that you should be using the Microsoft.Common.TextBox UI element in your createUiDefinition.json.
I have tried to reproduce a green check by creating a simple createUiDefinition.json as below with a Microsoft.Common.TextBox UI element as shown below.
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json",
"handler": "Microsoft.Compute.MultiVm",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{
"name": "textBoxA",
"type": "Microsoft.Common.TextBox",
"label": "VM Name",
"defaultValue": "",
"toolTip": "Please enter a VM name",
"constraints": {
"required": true
},
"visible": true
}
],
"steps": [],
"outputs": {}
}
}
I am able to reproduce the green check beside the VM Name textbox as shown below:
However, this green check DOES NOT imply the VM Name is Available.
This is because based on my testing, even if I use an existing VM Name in the same subscription, it is still showing the green check.
Based on the official documented constraints that are supported by the Microsoft.Common.TextBox UI element, it DOES NOT VALIDATE Name Availability.
Hope this helps!
While bmoore's point is correct that it's unlikely you would ever need this for a VM (nor is there an API for it), there are other compute resources that do have global naming requirements.
As of 2022 this concept is possible now with the use of the ArmApiControl UI element. It allows you to call ARM apis as part of validation in the createUiDefinition.json. Here is an example using the check name API for an Azure App service.
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{}
],
"steps": [
{
"name": "domain",
"label": "Domain Names",
"elements": [
{
"name": "domainInfo",
"type": "Microsoft.Common.InfoBox",
"visible": true,
"options": {
"icon": "Info",
"text": "Pick the domain name that you want to use for your app."
}
},
{
"name": "appServiceAvailabilityApi",
"type": "Microsoft.Solutions.ArmApiControl",
"request": {
"method": "POST",
"path": "[concat(subscription().id, '/providers/Microsoft.Web/checknameavailability?api-version=2021-02-01')]",
"body": "[parse(concat('{\"name\":\"', concat('', steps('domain').domainName), '\", \"type\": \"Microsoft.Web/sites\"}'))]"
}
},
{
"name": "domainName",
"type": "Microsoft.Common.TextBox",
"label": "Domain Name Word",
"toolTip": "The name of your app service",
"placeholder": "yourcompanyname",
"constraints": {
"validations": [
{
"regex": "^[a-zA-Z0-9]{4,30}$",
"message": "Alphanumeric, between 4 and 30 characters."
},
{
"isValid": "[not(equals(steps('domain').appServiceAvailabilityApi.nameAvailable, false))]",
"message": "[concat('Error with the url: ', steps('domain').domainName, '. Reason: ', steps('domain').appServiceAvailabilityApi.reason)]"
},
{
"isValid": "[greater(length(steps('domain').domainName), 4)]",
"message": "The unique domain suffix should be longer than 4 characters."
},
{
"isValid": "[less(length(steps('domain').domainName), 30)]",
"message": "The unique domain suffix should be shorter than 30 characters."
}
]
}
},
{
"name": "section1",
"type": "Microsoft.Common.Section",
"label": "URLs to be created:",
"elements": [
{
"name": "domainExamplePortal",
"type": "Microsoft.Common.TextBlock",
"visible": true,
"options": {
"text": "[concat('https://', steps('domain').domainName, '.azurewebsites.net - The main app service URL')]"
}
}
],
"visible": true
}
]
}
],
"outputs": {
"desiredDomainName": "[steps('domain').domainName]"
}
}
}
You can copy the above code and test it in the createUiDefinition.json sandbox azure provides.

vscode new language configuration not changing syntax colors

I'm trying to create a new language for syntax highighting in Visual Studio Code for the CPU12 assembly language. When I use the new language in a new .asm file, the editor knows that the comment character is (it adds a semicolon to a line when I type ctrl-k ctrl-c), but the text is white instead of the default comment color green. Do I need to specify to use the default vscode theme? If so, where?
package.json
{
"name": "cpu12",
"displayName": "cpu12",
"description": "cpu12",
"version": "0.0.1",
"publisher": "https://github.com/me",
"engines": {
"vscode": "^1.15.0"
},
"categories": [
"Languages"
],
"contributes": {
"languages": [{
"id": "cpu12",
"aliases": ["CPU12", "cpu12"],
"extensions": [".asm",".inc"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "cpu12",
"scopeName": "source.cpu12",
"path": "./syntaxes/cpu12.tmLanguage.json"
}]
}
}
language-configuration.json
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": ";"
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
(My ./syntaxes/cpu12.tmLanguage.json is empty.)
The problem was actually because ./syntaxes/cpu12.tmLanguage.json was empty. You need to specify in the .json file how to color line comments:
./syntaxes/cpu12.tmLanguage.json
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "cpu12",
"scopeName": "source.cpu12",
"patterns": [
{
"comment": "Line Comments -- Asterisk only works at beginning of line",
"match": "((;|^\\*).*$)",
"captures": {
"1" :{
"name": "comment.line.cpu12"
}
}
}
]
}