I have a LSP server that returns hovers/tooltips containing links.
If I link to an HTML file on the web (https://...) when you click it it opens that link in the browser.
If I link to a local HTML file (file://...) it opens that HTML file in VSCode, as if you wanted to edit the file.
Is there any way to make it open the local HTML file in your browser?
Edit 1: I found the code that handles this. Seems it just checks for http, https or mailto and opens those externally. Everything else it opens with VSCode.
Edit 2: Found an identical issue. Looks like there is code to work around this here and here
Related
The functionality I'm after is where Sublime Text opens the browser to the print preview of the file currently edited.
This is the following:
Have a txt file (in sublime).
Select File > Print
Observe that the default browser opens up to the print preview page (tested in firefox and safari)
The urls seem to point to the file being in a temp directory and generated as a html file.
file:///private/var/folders/05/q2p__63n3zx9k3yzcb8f9n0c0000gn/T/tmpbfkdzvmq.html
Note html generation isn't necessary for my use case, remaining as txt is fine.
The answer can be for either swift or objective-c. I'm after how to open the browser to print preview.
I believe the answer involves using Apple Events as mentioned by #Willeke.
These is the information I found that assisted me:
https://applescriptlibrary.files.wordpress.com/2013/11/apple-events-programming-guide.pdf
http://webcache.googleusercontent.com/search?q=cache:B5zOBQgWUoMJ:mirror.informatimago.com/next/developer.apple.com/technotes/tn2002/tn2082.html+&cd=1&hl=en&ct=clnk&gl=ae
https://discussions.apple.com/thread/7743420
In pseudo AppleScript code, it would be something like this:
tell default browser
launch
print document
endtell
I have used VSC with LiveServer for some years with only 1 problem, back a few years ago when either LiveServer or Windows10 had an update installed, next time I opened my HTML file in LiveServer, the HTML was rendered in a "basic" layout, and did not include my CSS Styles.
On an Internet search I found a solution for either this site or similar where I needed to add a line of code to either LS or Windows, sorry but I cant remember which. And all was well again until, now. The very same problem has returned, and no matter how much I search, I cant fine the solution.
There are plenty where there were errors in HTML or CSS, but this is occurring on files which haven't changed, and on new ones from the same master I use for my new pages. The screenshot included shows the HTML, LS as basic HTML and how the page loads on the browser directly. I am using Chrome, but have tried on Firefox with same results.
How LS displays and how it should be
You need to open your VS Code project from a directory that contains your HTML and CSS.
Your HTML document is in the root directory of your project (hence the URL being /filename) but you are trying to load CSS from ../../css/filename.
The project needs to be two directories higher for the webserver to include that path.
I'm trying to open a file for edit from Office365's OneDrive in desktop version of Word(I'm logged in with my Office 365 account) using ms-word protocol and I have noticed that there are several possibilities:
Sometimes file opens in edit mode, I can edit file and by pressing Ctrl + S save it directly to OneDrive without being prompted for any additional actions.
Sometimes file opens in Read Only mode, I can switch to Editor mode, but then when I try to save file I'm prompted to specify save location(default location is my OneDrive directory with this file).
Sometimes Word asks me to login to my Office365 account(even though I'm logged in with this account in Word), then opens file in Read Only mode and after it looks like 2nd case.
I would like to open it as described in 1st case so user doesn't have to make any additional actions.
My current scenario is:
User calls an API to create file.
API creates file in user's OneDrive using Microsoft Graph.
API returns direct URL to file and I open this file in Word using ms-word protocol.
By direct URL to file I mean: https://domain-my.sharepoint.com/personal/account/Documents/Apps/Microsoft Graph/appname/directoryname/filename.docx
URL to open file looks like:
ms-word:ofe|u|<file path specified above>
And as I described at the beginning there are 3 cases how file is opened and it looks randomly for me.
I have also noticed that when I open my file in Word Online(using web url to file) and then I press Edit in Word it uses exactly the same file URL I have created and returned to user but from here the file always open with 1st scenario.
Do you have any ideas why this behaves differently when I manually open file using ms-word protocol compared to Word Online using ms-word protocol with exactly the same url?
I would like to always open file from user's OneDrive in desktop Word in scenario when user doesn't have to make any additional steps to edit and save file back to OneDrive.
(I don't have reputation so I can't comment. I will try again with a partial answer.)
There is always a chance that the credentials will have to be refreshed, so there is no way to completely prevent Office apps from prompting for credentials but it should be relatively uncommon.
As to the issue of opening in edit mode vs protected mode: There are a variety of reasons why some files will open into protected view: https://support.office.com/en-us/article/What-is-Protected-View-d6f09ac7-e6b9-4495-8e43-2bbcdbcb6653
If you have a file that seemingly opens in edit mode vs some version of readonly or protected view, please use answers.microsoft.com where the conversation doesn't have to fit into the stackoverflow model.
when I open my file in Word Online(using web url to file) and then I press Edit in Word it uses exactly the same file URL
You suggest that the URLs are identical, but my first thought was that the difference may have been that the Word Online link uses the driveItem's webDavUrl property rather than baseItem's webUrl
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/resources/driveitem#json-representation
I want to create Tumblr theme and ineteresting is there any IDE (Netbeans, Eclipse, PHPStorm) plugins or tools for development? Ideal is to preview my theme in browser without uploading it to Tumblr.
Thanks.
I found my own way to develop tumblr themes using PhpStorm (or possibly any other IDE) and avoid the manual copy pasting to see my updates. I wrote a simple javascript to execute in your browsers console (MIT licensed).
setInterval(function() {
jQuery.ajax('YOUR-URL-TO-THE-THEME-FILE', {cache: false}).success(function(html) {
var btn = jQuery("div[data-action='update_preview']").first();
if (html!=ace.edit('editor').getValue()) {
ace.edit('editor').setValue(html);
if (!btn.hasClass('disabled'))
btn.click()
}
});
},1000);
Howto:
Use JetBrains PhpStorm to edit your html theme file ( It is possible to use other editors, the only important thing is that the file has to be hosted on a (local or public) server. )
Click Open in browser in PhpStorm while viewing the file.
Your browser should open with an url like this: http://localhost:63342/TumblrTheme/index.html.
Paste this URL in the snippet above.
Open http://www.tumblr.com/customize/YOUR-BLOG-NAME.
Click Edit html.
Open your browsers javascript console.
Paste in the snippet above (remember changing the path to your theme file).
The preview now is auto-updated every second if the source has changed.
Published at this gist: https://gist.github.com/cmfcmf/7154536
In terms of resources there's a few that I've found.
TumblrThemr
Thimble
Tumblr Boilerplate
There's also a TextMate bundle although it's a few years old.
Developing for Tumblr is a bit of a pain, the way I do it is by setting up a test tumblr to use, reblogging or posting each post type that I want (photo, photoset, audio, text, etc.). I work on the HTML locally and get it set up how I want it to, until I know I can do pretty much everything I need to achieve via CSS alone. I then host any assets (CSS/JS/etc.) on my server, use the theme editor on my test theme to update the HTML, and then anything I need to do can just be done on my remote assets. If I need to edit the HTML I do it locally then paste it back into the theme editor.
It's not the nicest way of working, but I've done about 4 themes that way and it works okay for me.
I'm creating an org-mode file that uses org-info.js to provide dynamic folding of exported HTML.
If I open the resulting HTML in a browser, I can copy the URL and paste it into an email that others can access by clicking but only if it's the top-level point on the page (no internal page target).
If I try opening a URL that points to an internal link (file:....#sec-2, for example), I get a "General failure. The URL was: .... The system cannot find the path specified." Deleting the "#sec-2" part of the link allows it to work just fine.
FWIW, I'm using org-mode 7.5 and the online version of org-info.js.
Is there a way to have this work?
Incidentally, the URL looks like file://fully/qualified/path/name.html (or name.html#sec-2) in the browser. When I add it as a hyperlink to a bit of text in Outlook (yes, I know; I use Gnus elsewhere), it transforms it into \fully\qualified\path\name.html. The lack of the file: and the / to \ doesn't seem to matter; the #target does matter.