Where is the "code" field in the Problems pane? - visual-studio-code

VS Code supports capturing error codes in custom problem matchers. What use are they? They don't seem to be displayed anywhere.
As described by the documentation:
code the match group index for the problem's code. Can be omitted if no code value is provided by the compiler.
For example, take the following tslint error:
ERROR: (comment-format) C:/Users/Kendall/Source/ncre/src/ncre.ts[84, 5]: comment must start with uppercase letter
Use this problem matcher:
"problemMatcher": {
"owner": "tslint",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(ERROR|WARNING): \\((.+?)\\) (.+?)\\[(\\d+), (\\d+)\\]: (.+)$",
"severity": 1,
"code": 2,
"file": 3,
"line": 4,
"column": 5,
"message": 6
}
}
The error is displayed in the Problems pane like this:
The code comment-format doesn't appear here.
I've verified that it's correctly captured by copying the error and the code does appear in the result:
file: 'file:///c%3A/Users/Kendall/Source/ncre/src/ncre.ts'
severity: 'Error'
message: 'comment must start with uppercase letter'
at: '84,5'
source: ''
code: 'comment-format'
Am I missing something, or is capturing the error code mostly pointless?

Update: it's implemented in VSCode September 2018. Hooray!

Related

Encountered unsupported property ComparisonOperator

Cloudformation stack throws Error "Encountered unsupported property Comparison Operator" , while creating an AWS::CloudWatch::Alarm using cloudformation.
As per AWS documentation ComparisionOperator value GreaterThanOrEqualtoThreshold is valid.
I use AWSTemplateFormatVersion as 2010-09-09
Any help would be appreciated :)
"CPUHighAlarm":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"AlarmDescription":"High CPU utilization",
"MetricName":"CPUUtilization",
"Namespace":"AWS/EC2",
"AlarmActions":[{"Ref":"asgScaleOut"}],
"ComparisionOperator": "GreaterThanOrEqualtoThreshold",
"EvaluationPeriods": "1",
"Threshold": "70",
"Period":"180",
"Statistic": "Average",
"Dimensions": [
{
"Name": "AutoScalingGroupName",
"Value": {
"Ref": "asg"
}
}
]
}
},
Just a typo. Should be ComparisonOperator instead of ComparisionOperator.
The CloudFormation Linter can help you catch these quicker and the Visual Studio Code extension can help prevent typos with autocompletion:
E3002: Invalid Property Resources/CPUHighAlarm/Properties/ComparisionOperator
Maybe it's case sensitive. Try GreaterThanOrEqualToThreshold.

TYPO3 CMS 8.7.27: Call to a member function getPackagePath() on null

After installing extensions in typo3 CMS 8.7.27, I got following error.. Seems like the ExtensionManagementUtility can't load the ah_contentapi.
This is my composer.json file in root (/var/www/html/typo3) for loading my extensions:
{
"repositories":[
{
"type":"composer",
"url":"https://composer.typo3.org/"
},
{
"type":"package",
"package":{
"name":"Bm/ah-content-api",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_config_typo3.git",
"type":"git",
"reference":"master"
}
}
},
{
"type":"package",
"package":{
"name":"Bm/ah-contentelements",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_contentelements_typo3.git",
"type":"git",
"reference":"master"
}
}
}
],
"name":"typo3/cms-base-distribution",
"description":"TYPO3 CMS Base Distribution",
"license":"GPL-2.0-or-later",
"require":{
"helhum/typo3-console":"^4.9.3 || ^5.2",
"typo3/cms-about":"^8.7.10",
"typo3/cms-belog":"^8.7.10",
"typo3/cms-beuser":"^8.7.10",
"typo3/cms-context-help":"^8.7.10",
"typo3/cms-documentation":"^8.7.10",
"typo3/cms-felogin":"^8.7.10",
"typo3/cms-fluid-styled-content":"^8.7.10",
"typo3/cms-form":"^8.7.10",
"typo3/cms-func":"^8.7.10",
"typo3/cms-impexp":"^8.7.10",
"typo3/cms-info":"^8.7.10",
"typo3/cms-info-pagetsconfig":"^8.7.10",
"typo3/cms-rte-ckeditor":"^8.7.10",
"typo3/cms-setup":"^8.7.10",
"typo3/cms-sys-note":"^8.7.10",
"typo3/cms-t3editor":"^8.7.10",
"typo3/cms-tstemplate":"^8.7.10",
"typo3/cms-viewpage":"^8.7.10",
"typo3/cms-wizard-crpages":"^8.7.10",
"typo3/cms-wizard-sortpages":"^8.7.10",
"typo3/cms":"^8.7",
"dmitryd/typo3-realurl":"2.*",
"GridElementsTeam/Gridelements":"8.2.*",
"clickstorm/cs_seo":"3.*",
"Bm/ah-content-api":"0.0.1",
"Bm/ah-contentelements":"0.0.1"
},
"scripts":{
"typo3-cms-scripts":[
"typo3cms install:fixfolderstructure",
"typo3cms install:generatepackagestates"
],
"post-autoload-dump":[
"#typo3-cms-scripts"
]
},
"extra":{
"typo3/cms":{
"web-dir":"public"
},
"helhum/typo3-console":{
"comment":"This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy":false
}
},
"autoload":{
"psr-4":{
"Bm\\AhContentelements\\":"public/typo3conf/ext/ah_contentelements/Classes",
"Bm\\AhContentapi\\":"public/typo3conf/ext/ah_content_api/Classes"
}
}
}
I already cleared cache in install tool at:
1. -> important actions -> clear all cache
2. -> clean up -> Clean typo3temp/ folder
piece from composer.lock:
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is #generated automatically"
],
"content-hash": "954afd2318d54ec9b1dd0e4d7f9b445b",
"packages": [
{
"name": "Bm/ah-content-api",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/hippovibe/ah_config_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
{
"name": "Bm/ah-contentelements",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/stevenhippovibe/ah_contentelements_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
The Error occurs when the extension folder name under typo3conf/ext/<folder_name> doesn't match extension key used in some places of the system (e.g. using EXT:your_extension_key/... syntax in TypoScript).
Changing folder name fixed similar problem for me.
Check the PHP version and try to change it from i.e. 7.4 to 7.3.
I once had this problem with an extension that should be compatible with PHP 7.4, but wasn't in real life. This solved the problem for me.
Question here is:
How did you update to 8.7.27 (which composer command was executed)
How does your composer.lock look like?
Do you use TYPO3 console or any other special composer plugins / CLI commands to e.g. generate PackageStates.php?
I just ran into the same error message under TYPO3 9.5.5.
Solution:
Deinstall one TYPO3 extension after the other and try it out again. This will lead you to the extension which has an error. Most probably the error is inside of the file ext_localconf.php or ext_tables.php .
I got this error detail:
PHP Warning: Use of undefined constant FH_DEBUG_EXT - assumed 'FH_DEBUG_EXT' (this will throw an Error in a future version of PHP) in /var/www/html/global-extensions/ext/div2007/ext_localconf.php line 15
This has nothing to do with your error. But it can be that you have an error in one of your installed extensions or even in a backup of an extension, e.g. a folder named as extensionname.bak .
Also these recommendations can help:
https://wiki.typo3.org/Exception/CMS/1476107295

How can I grab the Swift REPL compiler errors in JSON format

I'm looking to grab Swift compiler errors from the Swift REPL in a readable format such as JSON or XML
The best I can do is read it in as a String via standard in/out pipes. I have tried nearly every argument/option with swiftc with no luck.
I read that I can write Python scripts that extend LLDB but I wouldn't know where to start.
Currently the format reads in as:
/Users/joeblow/Desktop/pre-compiled.swift:1:38: error: cannot convert value of type 'Int' to specified type 'String'
var age = 10; var name: String = 12;
^~
But I'm interested moreso in something like this:
{
path: "/Users/joeblow/Desktop/compiled.swift",
line: 1,
position: 38,
error: "cannot convert value of type 'Int' to specified type 'String'"
}
I do not want to use Regex/String manipulation.
The swift compiler accepts the -parseable-output flag, which produces a structured output including the errors. For instance, if wrong.swift has the contents of your example, I see:
> swiftc -g -Onone -parseable-output wrong.swift
1149
{
"kind": "began",
"name": "compile",
"command": "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift -frontend -c -primary-file wrong.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk \/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/MacOSX.platform\/Developer\/SDKs\/MacOSX10.13.sdk -g -emit-module-doc-path \/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.swiftdoc -color-diagnostics -Onone -module-name wrong -emit-module-path \/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.swiftmodule -o \/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.o",
"inputs": [
"wrong.swift"
],
"outputs": [
{
"type": "object",
"path": "\/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.o"
},
{
"type": "swiftmodule",
"path": "\/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.swiftmodule"
},
{
"type": "swiftdoc",
"path": "\/var\/folders\/zc\/dp8ptx_10pg8m6pnwpbnjms00000gp\/T\/wrong-bc5f07.swiftdoc"
}
],
"pid": 33440
}
306
{
"kind": "finished",
"name": "compile",
"pid": 33440,
"output": "\u001B[1mwrong.swift:1:21: \u001B[0;1;31merror: \u001B[0m\u001B[1mcannot convert value of type 'Int' to specified type 'String'\n\u001B[0mvar name : String = 12\n\u001B[0;1;32m ^~\n\u001B[0m",
"exit-status": 1
}
However, while the REPL uses a swift compiler instance for parsing your expressions, it doesn't have a way to accept and pass "extra flags" to that compiler, so at present I don't think there's any way to get the REPL to emit errors in this form.
If you're interested in this capability then please file an enhancement request with the swift.org JIRA. If you are adventurous, you could even try adding it yourself. You would have to get the swift driver to pass this option to lldb, and then get lldb to parse and pass it to its compiler. Probably also have to extract only the errors from the output or it would be too noisy.

Escape $ in snippet

I'm trying to escape the $ character in my snippets but I cannot seem to get it correct.
If I use \$ as it looks like I should be from the documentation, I get the error:
file: path/to/snippets/php.json'
severity: 'Error'
message: 'Invalid escape character in string'
And no $ appear in my snippet.
If I use $$ found from this answer, I get a $ to show up but it thinks that the text immediately following is a tabstop.
If I use $\ it works but I have to have a character that is part of an escape sequence immediately following. So if I wanted $factory, I would need to do $\ffactory. \f seems to be the best as it does not effect the layout of my snippet.
I'm pretty sure that I am missing what needs to be done here.
My snippet for reference:
"factory" :{
"prefix": "factory",
"body": [
"\$factory->define($1, function (Faker\\Generator \$faker){",
"\treturn [",
"\t\t$2,",
"\t];",
"}"
],
"description": "Creates Model factory"
},
After much trial and error, I found that using \\$ will give me the desired results. So if I wanted $test in my snippet output, with test not being a tabstop, I would need \\$test snippet definition body:
"factory" :{
"prefix": "factory",
"body": [
"\\$factory->define($1, function (Faker\\Generator \\$faker){",
"\treturn [",
"\t\t$2,",
"\t];",
"});"
],
"description": "Creates Model factory"
},

Asterisk REST ARI snoop (cURL)

I try to:
curl -v -u j123:j321 -X POST "http://localhost:8088/ari/channels/1421226074.4874/snoop?spy=SIP/695"
In response to receiving:
"message": "Invalid direction specified for spy"
I try to:
SIP/695; SIP:695, SIP#695, localhost#695, channel, channelName
It's all not working.
Call comes into the queue from sip-416 to queue_1 and distribute to 694. I need to connect 695 for wiretapping channel 1421226074.4874.
I only need to listen and not to whisper.
Help me please)
The error message is telling you what the problem is:
"message": "Invalid direction specified for spy"
The spy parameter is a direction for spying, not the channel to spy on (see reference documentation here). You've already specified the channel to snoop on in the URI path - you need to specify the direction of the media in the spy parameter.
As an aside, apparently the auto generated wiki isn't display enum values, which is unfortunate. We'll have to fix that.
For reference, here's the parameter in the Swagger JSON:
"name": "spy",
"description": "Direction of audio to spy on",
"paramType": "query",
"required": false,
"allowMultiple": false,
"dataType": "string",
"defaultValue": "none",
"allowableValues": {
"valueType": "LIST",
"values": [
"none",
"both",
"out",
"in"
]
}