Im writing a language server for ExtJs using HoverProvider among other things, I've written other extensions including Task Explorer, but cant for the life of me figure out if there's a way to remove the default hover information, the word "any" that VSCode injects on all the properties and functions within the file.
See attached screenshot.
I guess since the js language servers cant read ExtJs class definitions (json object as a function expression), I get this "any" text on everything, I'd like to replace it or remove it somehow, is it possible? I can properly insert my doc, but that "any" is still there...
Hover info screenshot with the word "any" at the top
Related
If my JS code uses a module/varaible that is not yet imported, VSCode will underline it in red
Image showing underline in VSCode
How can VSCode be configured such that we can select the unimported variable, either press a shortcut or select something from the right-click menu, and select the appropriate module to be imported.
Similar to the Ctrl + . auto-import shortcut when dealing with Rust files
Create a clone of the Rust shortcut
Since there is already a shortcut that does what you want (albeit in a different language), you may be able to create a new shortcut based on the existing one.
First: open your keyboard shortcuts, and do a "reverse-shortcut" search for Ctrl + .. There's an icon near the right side of the search input that switches the search behavior to this:
You may find multiple matches; study them to identify the Rust import command that you like. In particular, take note of the "Source" column: if Source is "Extension," that means you're getting the Rust behavior from an extension, and you may need to find (or create) a similar extension that targets JS/TS. (I suspect you will, because I don't have any commands related to imports in my VSCode.) The next step requires that you copy the value of the Where column, so do that now.
Second: look at the "Command" column for the name given to this behavior. If the name is specific to Rust, do a new search for a similar command that doesn't target Rust. If there is such a command, you just need to configure it to run when you like: edit that shortcut and paste the "When" value from behavior; this may require a hand-edit if the When from the Rust command mentions anything specific about Rust (e.g. if it includes editorLangId == 'markdown', change that to 'javascript' and add alternative for typescript as well).
If there is no auto-import command that is language agnostic, and none that is specific to JS/TS (again, I don't see one in my VSC), you will have to rely on the Intellisense-based option, or find (or create) an extension that does this. Creating an extension is a whole other topic.
Normally, in Visual Studio Code, if you type in a variable or function that isn't imported, then Visual Studio Code will auto-correct it, if you select it.
For example, if I am typing half the name of a function, it will infer that I want a function, and when I hit Tab/Enter, it will autocomplete it, and import it.
See the GIF below for a visual example.
I just lost 1.5h of time trying to debug a piece of code I wrote only to find I had mistyped clickData.menuItemID instead of clickData.menuItemId
Is there a plugin or better IDE that automatically can check that I've named my variables or properties etc like this in the proper camelcase? I find this type of issue hinders me often and I can't always see the mistake when I'm trying to debug it.
Apparently no one else has wanted this feature, or I'm missing something. Intellisense works as normal, but I'm wondering if I'm missing a setting somewhere, if there is an extension, or if this functionality just isn't offered in VS Code... I would like to have the purpose of the method display when I start typing it as you can see in Adobe Brackets:
As opposed to how it shows in VS Code(which just shows the parameter requirements):
Is this possible?
VSCode is able to use the typescript language server to infer some information about the javascript that you're writing. The types for window/document etc are provided by the typescript team.
Here's where the type information for elements comes from. Compare that with the types for the document object. Notice that the properties here have comments above them, while the element properties do not. Type document.getElementById in VSCode, you'll see extra info like you do in brackets:
So for this information to appear about properties on Elements, someone would need to go through and add the comments. I have no idea if the typescript team is open to this, though.
I'm working in React, running WebStorm 2017.3.5
WebStorm is not recognizing the window object as anything special like it does in other JavaScript projects.
For instance, both of the following lines produce "Unresolved function or method" warnings:
window.addEventListener("resize", resizeHandler);
window.alert("foo");
These (and other standard window methods) also don't show up in the code completion section when I type window.
The behavior works as expected for document.
Anyone know what I need to enable to make Web Storm aware of window?
EDIT: invalidating cache did not help.
Possible fix:
Change language level from React to ECMA 6 (Settings --> Languages & Frameworks --> JavaScript --> JavaScript language version
Delete all code in the current file (cut to clipboard)
type window. on the now empty first line. Type hinting should pick up on window, make it a different color, and show methods for alert(), addEventListener(), etc
Paste original code
Return language level to React/JSX
I have no idea why the above worked when invalidating caches and restarting did not. I tried doing just 2 and 3 alone without success, and just 1 alone also without success.
I'm trying to get MonkeyTalk working with Javascript. I'm automating some tests with iOS. When I run the .MT version, the test runs fine. But, the Javascript version errors with this.
ERROR sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function uISearchBarTextField. (RADialerDirectory.js#8) in RADialerDirectory.js at line number 8
The export javascript code shows this:
this.app.uISearchBarTextField().tap();
Anyone know how to get around this error? I'm just trying to use the Javascript version of the script to loop and later grab external data to iterate through.
I had the same problem for "UIAleartView". There are three ways to get it work. this happen because MonkeyTalkAPI.js file doesn't contain an entry for "uISearchBarTextField"
Use more generic type(Input) like above answer.
Set accessibilityLabel property of that component and use it as a monkeyID like here: MonkeyTalk : Verify custom UITableViewCell Label text without select the cell
A little hack to MonkeyTalkAPI.js class. find the word for "Input" which is more generic to your "uISearchBarTextField" and get a copy of it paste it again in that file and edit replaceing "Input" with "uISearchBarTextField" save it and run. if you did it carefully it works.
Happy Testting