How to install typings for Visual Studio Code in an offline development environment? - visual-studio-code

I'm using VisualStudio Code, and trying to enable IntelliSense. It seems to be dependent on typings. How can I install these offline? In PowerShell, running
typings search leaflet
returned an error (unsurprising, because I'm offline).
Unable to connect to "https://api.typings.org/search?query=leaflet"
Running that web query on an online computer resulted in a difficult to read JSON file. A further google search resulted in this likely candidate:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/leaflet/index.d.ts
My question has three parts, and I'd appreciate pointers on any of these.
1) How can I figure out what typings I need?
2) Which files do I need to take to the offline computer? Do I just need the d.ts file?
2) Where should this file be installed so that VS Code can read it?

1) Simply put: if your Visual Studio Code is complaining about not being able to resolve something. Lets say I'm working with jQuery, I'm using $ a lot in my project and it's going to give me an error because it's not Typescript/JavaScript.
To resolve this, I create a JSON file to the root of my project called typings.json. It will look like this:
{
"resolution": "typings/",
"globalDependencies": {
"jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/index.d.ts"
}
}
Then in the Terminal tab (CTRL + SHIFT + <) execute the following command:
typings install
Now it will download the required typings and put the contents to root/typings/. You'll need to reference it in each file you're using (in this case) jQuery in by adding the following to the top of your TS file:
/// <reference path="./typings/globals/jquery/index.d.ts" />
You can also create a definition (.d.ts) file in the root/typings folder and add all the references there so you only have to reference that file.
2) After installing the typings in the previous step, you can copy the typings folder and put it on your offline computer. It's as easy as that. You don't need other files (not even the typings.json file, if you wish).
2) You need to reference definition (d.ts) files at the top of your .ts files.

Related

vscode extension development: svelte content not loading in webview after building the vscode extension

I am building a vscode extension by using svelte for webview. I am following https://youtu.be/a5DX5pQ9p5M. But the deployment of extension is not mentioned in the tutorial .
So i am following https://code.visualstudio.com/api/working-with-extensions/publishing-extension.
So after packaging the extension with vsce package and installing the extension the extension doesn't load svelte content but when running in developer mode everything works fine.
I tried creating the package extension multiple Times but still didn't work.
Check if all necessarily files are included via:
vsce ls
(You can also open packaged extensions, they are just ZIP-archives with a different extension.)
If they are not (e.g. src is excluded by default), you probably can create a .vscodeignore file and manually specify what to exclude.
Running extension problems can be inspected via Help > Toggle Developer Tools, usually you will find some errors in the console.
I do not know if debugging forces the extension to load, but if so, make sure you have set the correct activationEvents.

Why does an attempted export of a plugin fragment "not find the exported unit"?

I am writing a plugin fragment named JunitGenerationFragment. I can test it using Launch an Eclipse application, and everything works fine.
I try to export using the 3 steps on the Exporting section of the manifest's Overview tab. When using the Export Wizard, I choose to install into a particular directory.
I get a Problems Occurred dialog that says "Could not find the exported unit with id..."
As far as I can tell, the directories have the appropriate content.
However, if I try to install from that site, "There are no items available".
How can I successfully make this plugin fragment available from the export repository?
Possibly there was some kind of file system problem? Additional attempts to export the repository to the C:\Tools\Eclipse\workspace2019-06\.metadata\.plugins\org.eclipse.pde.core\install directory failed. However, I could export to another directory.
Later, I renamed the original C:\Tools\Eclipse\workspace2019-06\.metadata\.plugins\org.eclipse.pde.core\install directory to something else and retried an export to C:\Tools\Eclipse\workspace2019-06\.metadata\.plugins\org.eclipse.pde.core\install. This time it succeeded, and I could load the plugin from that repository.
Update: The renaming "solution" does not seem to be repeatable. A repeat attempt to use the Export Wizard to exprort to C:\Tools\Eclipse\workspace2019-06\.metadata\.plugins\org.eclipse.pde.core\install fails, as in the original problem description. Renaming the directory again did not help.

Change .vscode folder location

I'm programming a client side applications using SharePoint Designer 2013.
I want to change to VSCODE since it supports a lot of extensions for some Javascript library like angular, jQuery. And because of the Chrome/Node.js debugger extension.
But when I try to start any Debugger, I got the error:
Unable to create 'launch.json' file inside the '.vscode' folder (Error: UNKNOWN: unknown error, mkdir '\\servername\DavWWWRoot\sitename\Style Library\.vscode').
I get this error because it's impossible to create a folder in SharePoint where the name starts with dot.
So there's a possibility to change the name of this folder or the file location to any directory in my local computer?
No, it's not possible to move/rename that folder. VS code is a tool that bases project management on folder content. So it is essential that the project settings reside in the folder being managed.
You can move the "extensions" folder, but unfortunately not the argv.json (so the ".vscode" will, at least be recreated on vscode launch)
https://github.com/microsoft/vscode/issues/17691#issuecomment-559234574
I hope that'll finally change sometime .
https://github.com/microsoft/vscode/issues/3884
https://github.com/OmniSharp/omnisharp-roslyn/issues/953

Extension not found error with control flow extension

I am trying to use https://github.com/qiemem/ControlFlowExtension as an alternative to if-else.
I have it to added to the extensions folder(C:\Program Files (x86)\NetLogo 5.1.0\extensions). The extracted zipped folder from github.
In the NetLogo code I use the following,
extensions[ControlFlowExtension-master]
But it still shows me the following error:
There is no release for the extension yet. The zip file that you downloaded is just the source code and doesn't contain the compiled JAR files that you need to use the extension with NetLogo.
If you want to try it out, you will have to build it yourself. For that, you will need to install sbt. Then, open a command terminal and cd to the folder where you unzipped the file you downloaded from GitHub. This folder should be under the NetLogo extensions folder and be called cf (rename it if it is not the case). Once you are in the cf folder, run:
sbt package
This should build cf.jar and allow you to use the extension by putting
extensions [ cf ]
at the top of the code tab in your NetLogo model.
Be aware, though, that the extension is still very much experimental. There may be bugs. The syntax could still change. This is why Bryan did not put out an official release yet.

how to run doctrine.php in command prompt

I'm trying to use Doctrine with Zend, I have copied the doctrine.php and doctrine file in the script folder in the Source Files folder.
However when I type in command prompt following command: "php doctrine.php" by entering in the scripts folder, Nothing happens, there is no error printed, the cursor just goes to next line. Can someone please tell me how can I use doctrine.php.
When using Guilherme's integration suite, you need to do a couple of things.
Download / clone the Doctrine Common, DBAL and ORM libraries and make sure they're available in your include path. For this, I usually just copy the lib/Doctrine code from each into my project's library folder. If using git, you can add them as subtree splits but that's a topic for another time ;-)
You also need the Symfony Console and Yaml namespaces. Again, it's easiest to place them in your project's library folder under library/Symfony/Component/Console and library/Symfony/Component/Yaml. These usually come as submodule dependencies in the Doctrine libraries but you can also get them from their github pages
Console
Yaml
Remove the bootstrap('Config') call from the doctrine.php script. Don't know what Guilherme was thinking there :-)
That's it, from there it should work as expected.