Get all problems (errors, warnings, etc.) using VSCode extensions API - visual-studio-code

I am creating a VSCode extension and I need a way to access all of the current errors, warnings, etc in the Problems pane but I am not even sure if the API provides access to this. I see that I can create Diagnostics and it appears that I can get those diagnostics with the DiagnosticCollection but I don't see where I can get a list of all of the errors and such. Does anyone have experience with this.
p.s. I have tried
console.log(vscode.DiagnosticCollection) // undefined
console.log(vscode) // Looked through the object and found nothing of use
console.log(window) // Same thing. Nothing of use.

According to the documentation seems like it's not possible at the moment.
but I saw some discussions on adding an API to the problem view so that might be available in one of the next versions.

There are now 2 api's for this, see api reference: language diagnostics:
getDiagnostics(): [Uri, Diagnostic[]][] get diagnostics for all files
let diagnostics = vscode.languages.getDiagnostics();
getDiagnostics(resource: Uri): Diagnostic[] get the diagnostics for a specific uri
const uri = vscode.window.activeTextEditor.document.uri;
let diagnostics = vscode.languages.getDiagnostics(uri); // returns an array

Related

How to check if the text in an editor has focus when developing an extension?

Same to editorTextFocus, but I want to check this condition when developing an extension, what's the API for that?
I've tried the following:
if (window.activeTextEditor) {
// ...
}
But the result is not the same as using editorTextFocus.
So I've wanted something like a getContext API which is the corollary to setContext API, in this case, I would use it like getContext('editorTextFocus').
After a lot of searchings, I ended up in this Add getContext command PR, but it got rejected due to these reasons, basically saying getContext API is not the solution for this type of issues. I guess we'll have to wait until the VSCode team come up with a better API for this, let's hope it won't take too long.

How can I Jira issues by status within a specific project?

I'm making a call to the Jira API as follows:
https://synergix.atlassian.net/rest/api/2/search?jql=project="PROJECT_KEY"
This gets me back issues in that project. However, what I really would like is to get the issues back in the project by STATUS e.g. all the issues within that project that are "In Progress" or "Open" or "Resolved" etc.
I have explored Stack Overflow and Jira's documentation for an answer but a lot of the answers seem to relate to getting issues by status for multiple projects, whereas I want them just for THIS project key (as that's the one my team are working on).
Can anyone help please?
Thank you
The jql parameter present in your URL accepts any JQL syntax, so you may add and (status="STATUS" or status="STATUS2") to your parameter.
Example: https://synergix.atlassian.net/rest/api/2/search?jql=project="PROJECT_KEY"%20and%20(status="In Progress"%20or%20status%20=%20"Open")
I think the JQL you're looking for is this:
project = Product key // within your project
AND issuetype = Story //by story
AND status in ("open", "In Progress", "Closed") // the statuses you'd like to see
order by status // ordered by, you guessed it, status
I'm not sure how to format it for the Jira API, but I'm sure there's a fairly straightforward translation.

How to put a message in VS Code Problems window

I have a VS Code extension which enforces a json schema onto a json file. When there is an error, it posts a message into the Problems window which is great.
How can I write to this window, from my extension, to put my own messages in the Problems window?
I have searched the docs, and could only find showInformationMessage, showErrorMessage and showWarningMessage but none of these put the message anywhere visible that I can see.
Any hints to the correct method or a suitable doc page would be most helpful.
You can use diagnostics for this. The starting point for that API is createDiagnosticCollection() from the vscode.languages namespace. vscode-extension-samples has a simple example for this. The basic idea is that DiagnosticCollection acts as a map with URIs as keys and arrays of diagnostics as values.

Deploying actions on google webhook on glitch

I want to deploy this example on glitch. I've added package.js and index.js to my glitch project and built successfully.
However, the code is missing a section to listen for HTTPS requests. In most node.js/express webapps, there is code to indicate which paths trigger which functions, but this is missing from the example. Can you explain to me how it should work and why that part is missing from this example?
It's not clear what do you mean by "the code is missing a section to listen" as the only main feature of index.js is to listen to requests and return information.
I suggest you check index.js and make sure that you getting requests to your end point on glitch.
Also, it would be helpful if you can share your glitch project over here at SO so we could see what you are doing.
Btw, you might want to double check that you have all the packages
I also created this simple example on Glitch - It's returning the current bitcoin price. Feel free to remix it and use the code there for your own action.
Good luck!
The part that "listens to requests" is
// The Entry point to all our actions
const actionMap = new Map();
actionMap.set(ACTION_PRICE, priceHandler);
actionMap.set(ACTION_TOTAL, totalHandler);
actionMap.set(ACTION_BLOCK, blockCountHandler);
actionMap.set(ACTION_MARKET, marketCaptHandler);
actionMap.set(ACTION_INTERVAL, intervalHandler);
assistant.handleRequest(actionMap);
where each ACTION is an action(in an intent) in Dialogflow and the handler is the corresponding function in your code.
I'd recommend you take a look at
https://codelabs.developers.google.com/codelabs/assistant-codelab/index.html?index=..%2F..%2Findex#0
If you want a good example of an assistant app, though this uses firebase instead of glitch.

Google Analytics Easy Dashboard Library

I was trying to mess around with this new "easy" way to use google analytics API. Did not work for me even though I followed the instructions correctly. Anyone have any issues with this?
Try it out...
http://analytics-api-samples.googlecode.com/svn/trunk/src/reporting/javascript/ez-ga-dash/docs/user-documentation.html
Another easy fix is to set up a button to actually call the render method, rather than having it execute instantly like the basic example. (last line, chained method)
- or a 3-5 second timeout
Or use the "cool demo" link for a better starting point code
yes i tried it also and not worked.
It seems like i'm missing some library on my localhost. I've checked the scripts execution and when it does
if (gapi.client.analytics) {
it throws the error:
Uncaught TypeError: Cannot read property 'analytics' of undefined
this.renderFunction();
Regards
While I was getting an undefined error, I changed code in line 220 as a temporary fix.
Know it loads perfectly. this is the code:
// If the client library has loaded.
if(typeof gapi.client != 'undefined'){ //new code
//if (gapi.client.analytics) {