A method to expose the VSCode active 'when Clause Contexts' - visual-studio-code

I'm searching for a method to expose VSCode active 'when Clause Contexts' e.g 'explorerResourceIsFolder'. To give you a better understanding of my use case, here's some background on the project to which a VSCode extension is being developed. My extension will facilitate programming in and controlling VSCode by voice.
Caster is a Dragonfly-Based Voice Programming Toolkit. Dragonfly is a speech recognition framework. It is a Python package which offers a high-level object model and allows its users to easily write scripts, macros, and programs which use speech recognition. The goal behind these projects is to enable those who limited interaction with keyboard or mouse to program or for Devs to boost productivity.
Some current outstanding limitations with Castor and Dragonfly both interact by emulating keystrokes. This is just to name a few issues.
Reliability of IDE of performance different system configurations and IDE versions. This introduces variables such as command execution latency.
Castor is completely unaware of the IDE environment.
Dragon NaturallySpeaking has an upper complexity limit on Grammars.
After the limit is reached, a BadGrammar error will occur.
Limited keyboard combinations and not all functions can be called by shortcuts.
Some examples via Adom editor
find in buffer": R(Key("c-f"), rdescript="Atom: Find in Buffer")
Only a few relevant commands are useful within 'Find in Buffer' context, but Castor commands are global which decreases command speech recognition accuracy and increases grammar complexity. With Caster IDE integration would allow for llimited command sets specified to IDE contexts or focuses.
"split into lines": R(Key("cs-p") + Text("Split Into Lines") + Pause(atom_palette_wait) + Key("enter"), rdescript="Atom: Split Into lines"),
Not all IDE functions can be called via shortcuts or be easily re-created within castor. My attempt to work around this within Adom was to utilize command palette. While this extended my ability to trigger commands it introduced latency. To fast the wrong command would be triggered. Too slow it a decrease productivity. Indexing latency which based on system load, system specs, number of active plug-ins, and number of characters per command. We tried to mitigate this by using Pause(atom_palette_wait) but the variables in the latency were too complex. The same would be true of Studio Code.
Castor framework IDE integration
Castor would contain IDE functions to pass to IDEs plug-ins/extensions for execution.
For example "Find ": find R(SendFunction("actions.find"), rdescript="VisualStudioCode: Find")
Castor would listen for contexts or focus announced from IDEs .
Castor would store commands and functions based on IDE context or focus. Then activate the only relevant commands containing shortcuts or IDEs functions based the focus announced from the IDE.
IDEs plug-ins/extensions framework
Listen for and execute IDEs specific functions from Caster
Announce current contexts or focus to Caster
As a long-term goal extend functionality of IDE ( e.g. in Visual Studio Code adding numbers to IntelliSense list) The user would speak the number and the appropriate line would be selected and executed.
There will be three parts to the Studio Code Extension.
A websocket running a server and client that allows for bidirectional communication to Castor.
A function that executes 'Command_id' e.g 'editor.debug.action.toggleBreakpoint' In progress - Near completion
A method to expose the editors 'when Clause Contexts' e.g 'explorerResourceIsFolder' - Searching for method - No luck via the APIs thus far - Searching source code to understand implementation.
Any suggestions would be welcome. If you think this is worth opening a github ticket on the VSCode repository let me know.

There is a non public api for getting the when context in effect. You can use getValue(key: string). It is available from the work on this issue ticket:
Lift setContext from a command to proper API Microsoft/vscode#10471
and the source can be viewed here:
contextKeyService.ts
by using getValue(key: string)
It is still work in progress as of May 2017. Thank you. Good day.

Related

Robot Framework Language Server Extension automatically opening CANoe application

I use Visual Studio Code with Robot Framework and Python for test purposes. I also use CANoe application as a simulator.
I installed the Robot Framework Language Server and for some reason when I open VSCode or even just click on it CANoe automatically opens, I know that the extension is causing this because if I disable the extension the application stops to automatically open.
Do you already had any similar behavior with Robot Framework Language Server and any other process? If yes, how did you solve it?
There are 2 different LSP implementations for robot framework. This answer relates mainly to the one Robocorp maintains.
That particular implementation of lsp works by executing each LIBRARY settings section in python interpreter and executing the actual library's constructor to get the data it needs for auto completion / typing / whatnot. If the python library makes any connection to com API thats associated with CANoe during execution of the constructor, it will trigger actual CANoe application to start - even if that's not mandatory at this point but that's how COM works.
I'm quite there are ways to hack around the issue but essentially, the easiest way to fix this is to;
Fix the library that provides your keywords that interact with CANoe and/or ecutest or similar that requires CANoe to be running.
Try switching to https://github.com/d-biehl/robotcode within vsc to provide you autocomplete and the rest ..
If you where using robotcode lsp, see first suggestion.

how would I find all the places in all blueprints where there is a call to ParallelFor()?

I'm trying to fix some incorrect calls to ParallelFor() that are appearing in performance profiles. I can't seem to find it in the Blueprint scripts in the Unreal Engine 4 project I'm working with. The Unreal documentation is sparse, and only tells me how to use it in C++.
Any ideas? I'm really concerned that I can't do a plain-text search for functions like this inside the Blueprint scripts. The Unreal Engine dev forums didn't help. The existing search mechanism via the search boxes appears to be for variables.
Using grep in the project folder fails.
There are many factors to muti-threading speedup, number of cores, utilization, memory, scheduler...
The problem may be external to the code.
On to the question:
Many of the built-in blueprint functions are implemented natively in C++.
I would suggest looking at the profiler call stack(tree view); Follow it up to something named similar to a node. This technique may fail for cross thread dispatches.
You will have to download the source code and look there to find the calls.
The other way is to build a debug build(with symbols) of the game and attach a debugger to the process.
The call was built-in to the framework in my case.
Thanks for pointing me in the right direction.
You can easily search trough all your BPs from withing the editor with
CTRL+SHIFT+F or window -> developer tools -> find in blueprints.
You get also there from within a blueprint, CTRL+F enter what you'r looking for, and on the right side there is kind of a book symbol in the same line where you can search all blueprints.

Is there a unified keyboard shortcut solution for IDEs, like Eclipse, IntellJ, JDeveloper... So I don't need to remember so many shortcuts?

We developers often working on some different projects and often we need to switch IDE tools, like Eclipse, JDeveloper, IntelliJ. But one problem is there are so many keyboard shortcuts to remember...
But that's quite a burden to memorize these. So I want to minimize the memory burden and hope to use the same shortcuts everywhere.
I searched online and found there was an old project on Mac OS for this proposal (https://github.com/fe9lix/CodingKeys).
"What problem does it solve?
Nowadays, developers often work in several different development environments and text editors. For example, you may need Eclipse for regular Java development, Android Studio for Android development, Xcode for iOS development, Visual Studio for C#, Sublime Text for web development, etc.. Every tool, however, has different keyboard shortcuts. Since it is hard to remember all shortcuts, there's a constant loss of productivity when switching tools. If you don't want to edit all shortcut sets in every tool, you can instead use CodingKeys as an "abstraction layer".
CodingKeys lets you define unified shortcuts, which are dynamically re-mapped to existing shortcuts of other applications when you switch tools. All mappings can be conveniently edited in a single configuration file. The config file also gives you a nice overview of all shortcuts and grows as you add new apps to your coding toolbox."
This is exactly what I need. However, I didn't find anything like this on Windows or Linux.
So firstly I want to know how these shortcuts invented at the very beginning?
Are they just come up from someone's mind and then all followers adopted that. Or have they collected some stats and found what are the most frequently used keys?
Can we do some stats and build the best shortcuts for all IDEs?
So is it possible to unite all keyboard shortcuts across IDEs? Or how to reach there (if not today maybe we can reach there in future)?
Alternatives of CodingKeys for Windows and Linux
For Windows, you can try AutoHotkey and its remapping keys feature. Unlike some other solutions, it lets you remap the keys per application - by using the IfWinActive directive.
For Linux, there are probably some alternatives or ports, see https://unix.stackexchange.com/questions/165124/autohotkey-equivalent.
How the shortcuts were invented?
Yes, I would also like to know. I'm afraid in some cases though, there was no deep investigation before introducing some shortcuts.
Another reason for editors having some unfortunate default shortcuts (both Eclipse and IDEA users will surely find some) may be that authors just don't want to change them, because they want to retain backwards compatibility for users. Even though in the long run it would possibly hurt less to change them to some common ones, which brings us to the last topic...
Can we do some stats and build the best shortcuts for all IDEs?
I was just thinking about this idea before getting to this question. It would be great to have some kind of initiative that would do the research and that would propose some "unified set of basic IDE shortcuts". It would consider not just IDEs, but text editors generally, while web browsers play an important role nowadays as well (with their navigation or debugging shortcuts).
It looks like there is no initiative like that so far. I can see 3 main reasons for that:
It definitely isn't easy to do the research and to agree on some common shortcuts that would satisfy all.
Unless using some workarounds like AutoHotkeys, it would require active cooperation of all the major IDEs authors in order to efficiently improve the current state of things. I'm not sure how realistic it is.
Although far from perfect (which is given by-design), there exist those predefined keymaps for various IDEs that can somewhat mitigate this problem.
A lot of IDEs and Editors today have one of their standard keymaps, but they also come along with keymaps from an other IDEs and editors as well.
For example, if you are using Visual Studio Code, they have their standard keybindings, but if you come from an other editor, you can search extensions for other keymaps as well:
Anyway, any editor or IDE you use, just search their plugins or extensions for keymaps and you can install keymap you are familiar with.
My thought on unified keymap (one that you can always use), would be Vim keymap. If you learn that, you are on a good path in any editor.

Will emacs/vi ever be able to implement Intellisense/Refactorings as well as Visual Studio and Eclipse?

I love the old school editors because they enable users to absolutely fly through their code, editing almost as fast as they can think.
However, they suck balls at awareness of their environment, lacking robust implementations of features like Intellisense (pre-emptive strike: no, there really isn't an intellisense implementation in emacs that is trivial to install and doesn't suck) and common refactorings (pre-emptive strike #2: "global search and replace" does not a refactoring tool make). (i.e. It would be nice to be able to use nothing but vim to develop in .Net, but at the moment it is an ill-conceived undertaking at best).
I love Visual Studio/Eclipse/XCode because they are so integrated with their environments that I almost never need to look up API documentation, and can refactor fearlessly.
However, they suck balls at basic text manipulation and macros (relative to vi/emacs), are not available on all platforms (with exception of Eclipse), are likely either going to change nontrivially or perhaps just not be around in the next 10-20 years, and most importantly, are unable to run tetris.
Will we ever see the day when emacs or vi will be able to be as tightly integrated with .Net, Java and Objective-C projects as Visual Studio, Eclipse and XCode?
If not, is it because of proprietary concerns? (i.e. would require emacs to ship with a copy of the .Net framework)? Or is it just because at the moment our team doesn't have the manpower?
Why not load a Vi / Emacs emulator into Visual Studio / Eclipse and get the best of both worlds?
There are free versions of both for Visual Studio 2010 and above.
VsVim - Free
Emacs Emulator - Free
ViEmu - License Fee, works prior to VS 2010
Eclipse has some as well.
Vrapper
See eclim which provides Eclipse features for Emacs/Vim, so you can work in your favorite editor while having intelligent completion and other features supported by an Eclipse backend.
If we don't have the manpower to implement these features natively then the best we can do is to utilize the features implemented by others.
I think a significant part of the reason is technical and is due to Elisp: Elisp is very slow, and it lacks libraries. A good IDE requires a good parser, various auxiliary data-structures, and needs to be fast (e.g. parsing many files).

Eclipse Code Templates with Cobol

People,
My team is just beginning to learn how to use COBOL on Eclipse (as part of the Rational Developer for System Z package) and one of our most desired features are code templates or code snippets.
What we'd like to have is a code completion based on snippets just like we have on Java. For example, when I type try and hit ctrl-space Eclipse shows me a list of completion options, where one of those is create a try/catch block. Well, in COBOL one could leverage this when creating, for example, embedded SQL blocks, like
EXEC SQL
SELECT field, field, field,
FROM table
WHERE field = value,
field = value
END-EXEC.
However, for some reason, it seems that Eclipse treats COBOL a little differently (no wonder why) from other languages. As such, when looking for the code templates in the preferences menu for COBOL, its appearance is very different from the Java one.
The question is: how does one uses Eclipse's code templates with COBOL?
[Fair disclosure - I work for the vendor I mention below]
The answer probably depends on what COBOL & plug-in you're using. If you have the Micro Focus Eclipse product (either the one for Net Express or Server Express, or the Server Express Remote Development Option), the code snippets are supported. There's a number built in but you can also build your own.
You can get more details at http://www.microfocus.com/eclipse/
I'm afraid I don't know how/if other Eclipse plug-ins have similar capabilities.