How can I lookup interactively the inferred type of a variable within the vscode IDE? - daml

Some IDEs allow you to inspect the inferred type of a variable (i.e. IntelliJ provides Scala types using Ctrl-Shift-P). Does the DAML IDE provide something like that?

You can use Ctrl-K Ctrl-I (or Cmd-K Cmd-I) which is the shortcut for displaying hover information which will also include the type. At the moment, there is nothing that only shows you the type.
Take a look at https://code.visualstudio.com/docs/getstarted/keybindings#_rich-languages-editing for more shortcuts.

Related

PhpStorm: any way to change file type dynamically

I failed to find any information on how to change file type dynamically for PhpStorm. For example I need to deal with HTML files, which could have some PHP, Twig markup, embedded JS at the same time.
It is of course possible to choose the type via Preferences -> File Types, but the pattern can be registered for one file type only, and this is a problem.
It is not possible to enable multiple types for a single file, and it is not convenient at all to switch types via settings all the time.
You cannot use "Open as" or change language on the fly.
Please follow these and related tickets (star/vote/comment) to get notified on any progress:
https://youtrack.jetbrains.com/issue/IDEA-113835
https://youtrack.jetbrains.com/issue/IDEA-103297 (recently got Priority boosted from "Normal" to "Major")

Live templates in PhpStorm not useful

I installed "Live Templates for Angular" plugin in PhpStorm. I think something is wrong with suggestion (triggered with Ctrl + Space). I have to write whole snippet a-component to get to right suggestion.
Can I improve it somehow in settings?
Here is a gif:
It's because the template name (abbreviation) has a dash - in it ... and when completing IDE treats a and component as separate parts until whole match is found (in case you were doing some subtraction operation with two variables). At very least that's my understanding of this behaviour based on my own usage experience.
You may just change the abbreviation and remove - from there and it will be much better recognized as valid completion item. But that may not be ideal in long run (potentially may have issues when plugin will be updated with new templates etc.)
To bypass it ... just use Live Template specific completion where only Live Templates will be listed. For that invoke shortcut assigned to Code | Insert Live Template... action (Ctrl + J on Windows using Default keymap) at any time when you're typing your Live Template abbreviation.
Please make sure the applicable context yet.
Apply to the specified type of file, or check everywhere.
Like below:

Collecting Visual Studio Intellisense results from command line

When you open json files that have a "$schema" property in Visual Studio 2017, intellisense will add messages to the Error List window describing which lines in the file do not match the schema (e.g. missing required property, wrong data type, doesn't match pattern, etc.). This only happens if the file is currently open.
I would like these results to show up when I build (even if the json files are not open). I don't want to make an extension to do it, but I do currently run a custom executable during the build. I know how to format the output of the executable so that errors and warnings generated by that tool show up in the Error List window.
Basically, I am wondering if I can use that to somehow force the intellisense results specifically from the json files to appear in the Error List window. I would like to have the ability to promote some of the messages to errors and some to warnings, so I don't just want to hack it in by forcing the json files to open during the build. (Can I somehow use MsBuild to get intellisense results from json files?)
If there is no way to collect the results of intellisense in an external tool, then I will most likely use a completely separate json validation library instead. I just wanted to save the effort since it is built into Visual Studio. Thanks.
It turns out that NJsonSchema (https://github.com/RSuter/NJsonSchema) is so easy to use. If anyone has ideas about intellisense, that may still be useful, though.

vim: project wide auto suggestion

When using eclipse upon pressing control space, it show a list of all possible matching function calls irrespective of the file locations.
Is there a similar plugin for VIM ?
I am using vim7.4 and shougo's neocomplete (https://github.com/Shougo/neocomplete.vim). I actually switched from shougo's neocomplcache to this plugin. I am so far satisfied with the auto-complete feature provided by the nice plugin.
I don't write php code though, I made two screenshots of one of my python project.
screenshot 1,
left side is a module tmux_cmd.py, right side I have imported the module, when I type the module name, the plugin suggested me all functions/variables in that module.
screenshot 2,
in same module, when I type keywords (load) in this case, the plugin shows me all possible functions. I opened tagbar on right side to show functions in the current module. I can press <TAB> to choose the one I want, or keep typing something else if I just want to have something else, like loadnothing.... In the screenshot I pressed <tab>
You only need to index your project with ctags (see :help tags and :help ctags) and vim's built-in omni completion will do what you want for PHP when you press <c-x><c-o>.
Vim doesn't do auto-completion, though, you'll need a plugin for that like the one cited by kent but there are others.

Snippet with Custom Variables

I'd like to create a package containing a series of snippets that incorporate user-definable variables. For example, I'd like the user to be able to provide a value for a variable called HOSTNAME and have the snippets include that user's value.
The Sublime Text Unofficial Documentation explains:
Snippets have access to contextual information in the form of environment variables. Sublime Text automatically sets the values of the variables listed below.
You can also add your own variables to provide extra information. These custom variables are defined in .sublime-options files.
I've had no luck finding any information on the syntax for a .sublime-options file, however, and Sublime does not seem to try to read a file with that extension when I save it anywhere under the Packages directory. Is this a typo?
Using a .tmPreferences file seems to do what I'm looking for. Is this the only method of getting user-defined values into a snippet? Is it possible to use a .sublime-settings file?
The .sublime-options, actually, is the .sublime-settings. .sublime-options were the ST1 files and the docs got outdated, BUT you use the wrong link, you should always check and switch in the sidebar on the left to your version - ST2, ST3.
And to answer your question, you need to put the variables in .tmPreferences as may be seen here