How to get highlighted text from active terminal in VSCode Extension API - visual-studio-code

I am trying to build an extension using the VSCode API in which I need to get user's selected text wherever it is either in the activeTextEditor or activeTerminal. I see the way of getting the text from the selection for activeTextEditor. However, I am not able to find a way to get the highlighted text from activeTerminal. Appreciate any help on this.
vscode.window.activeTerminal

It seems there is no API available for that. You have the activeTerminal, but not the content the user selected.
The closer API request I found what this one (https://github.com/microsoft/vscode/issues/47615), which was in fact connected with the activeTerminal API.
So, if you really need this feature, you should open a feature request in VS Code repo (https://github.com/microsoft/vscode/issues/new/choose) asking for this new API.
Hope this helps

Related

Do I have to manually parse the document to show SignatureHelp?

I'm creating an extension to add support for a custom language on VS Code and I'm struggling on providing Signature Help because I can't seem to find a way to tell what signature I should show the user unless I manually parse the entire document to find out what is expected.
My question is, does VS Code API provides some way for me to tell the function/etc where the user is when the provider is invoked or do I have to parse the document manually so I can find it by myself?
I'm using the "direct implementation" way (without language servers), if that matters.
I hope my question is clear, thanks in advance.

How to redirect the data from "vscode.previewHtml" in VSCode extension

The obvious way is written in Working with the HTML preview, to use some link, so how to send data to the base running program without clicking links? I want to make some seamless extension between editor and previewer.
A few possible ways:
Open a local communications channel between your extension and the page. The extension could setup a simple server for example that the webview hits. This is best if you have lots of data to send or need to support more complex scenarios.
Inside the webview, you can instead post a message simulating a click with a command. Here's what VSCode's built-in markdown extension does for example:
window.parent.postMessage({
command: 'did-click-link',
data: `command:_markdown.revealLine?${encodeURIComponent(JSON.stringify(args))}`
}, 'file://');
The second approach is pretty hacky but it works well to just trigger events every so often.
We are also considering a better API for this. Please let us know if you have any thoughts or suggestions for this

Rest Console for Chrome won't let me input any info

I installed the Rest Console extension onto Chrome. I can't use this Rest Console for anything, because the only fields that accept text are 'Request URL' and 'Request Method'.
I ask here as there is no resources or community accessible for even simple instructions on how this extension works, and there are likely members of this community who have used this extension.
Use the Postman - REST Client it works perfectly!
your_url_to_post: Fill the URL
your_json_param: The name of the param that you'll pass you json
your_json_data: The json content
Don't forget to select x-www-form-urlencoded if you'll do a post
http://i.stack.imgur.com/TISW1.png
You should be able to enter text in the other field if you tick the checkbox associated to the field first.
I started having a similar issue myself (Forms wouldnt let me input data I could click them but thats as far as it went) across a lot of web pages to include my own php game and I know the form code hasnt changed at all before this issue started. I came across a article of someone else having a similar issue themselves that I was having and someone said that they needed position: relative on their forms that are not given specific instructions on positioning when dealing with google chrome. I have since made this change myself at www.immoralattack.com and the issue has stopped on that site but still continues on many others so its pretty safe to say that is the issue.
Its only happening on the dev build of chrome for me atleast and I hope this isnt something they plan on implementing on live or this will mess up alot of websites.
Also try turning off auto fill from chrome if its on, while I was looking for this bug I found alot of similar bugs but they delt with auto fill being on.

Bing Image Search API autocorrect feature...?

I am trying to use BING's image search api, but the problem is when I miss-spell something it automatically corrects the and doesn't tell me that "Hey we have auto-corrected your query!" , I want to know if my query has been auto corrected and what's the replacement word they have used.. Has anyone done this before...?
This is the query I am using.. note "Aemrica" has been mis-spelled deliberately but it still it gives me results for "America"
https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/Image?Query=%27Aemrica%27&$top=50&$format=JSON
but does not tell anything that the word has been replaced. Is there any way around it..?
i am using the response for iPhone.
No there is no way around this. Even the SearchResponse.Query.SearchTerms response parameter appears to still be the incorrectly spelt version.
I would suggest contacting Microsoft if this is a big issue for you.
EDIT: If you upgrade to the new Bing Search API based on the Azure marketplace, you can now get this data by first making a call to the SpellingSuggestions endpoint.

How to ensure a place is part of the Google Places autocompletion

We got a customer looking after an event called Floriade placed in the city of venlo in the Netherlands. This point of interest is sometimes shown on the autocompletion under Floriade 2012. I say sometimes shown as we used to see it, then it disappeared, now it is back again.
1-How can I be sure that the autocompletion (through Google Places API) is showing this point of interest ?
2- What is enabling a point to be in this autocompletion or not ?
If a place has a Google Places page, e.g http://maps.google.com.au/maps/place?cid=14788366310032789085 it is guaranteed to be returned by a Places Autocomplete API.
You may have experienced a bug in the API. If it occurs again please report it on the issue tracker: http://code.google.com/p/gmaps-api-issues/issues/entry?template=Places%20API%20-%20Bug
Another way to guarantee that your application will show a place is to perform a 'Place Report Request' using the Google Places API with your API Key. This will instantly add a place and make it available to your API Key, then if the place is approved by Google if will be available to anyone.
Cheers
Chris