How can I use the Variables Reference in vscode extension code - vscode-extensions

I want to use the variable in https://code.visualstudio.com/docs/editor/variables-reference#_predefined-variables in the vscode extension source code.
How can I get the access to them? Anyone know it?
There is no direct method to get them on official website or github.

I don't think there is any api access to the built-in variable resolver. You will have to make your own. Here is a good example from another extension Commands:
https://github.com/usernamehw/vscode-commands/blob/master/src/substituteVariables.ts

Related

How to use css-to-react-native

Dumb question. I've added css-to-react-native to my project, but the Readme doesn't actually give instructions on how to use it – well of course there are instructions on how to use its functionality but not how to tell my project to use it. Do I import it, or part of it, into the file where I want to use it? Some other kind of set up?

How to prevent the perl compiler from changing the name of dynamic link library

I'm making a perl6 package which contains some c source files that will be compiled into a dynamic link library. I found that the name of the library, such as libperl.so, will be changed into something like "A858A3D6EC5363B3D3F59B1.so" after "zef install". However, the name is used in python code as a module name(libperl). After the change, it is no longer a valid identifier. So, is it possible to prevent the change? If it is, what should I do?
I am not sure if it's possible to do that. Maybe it is.
Inspired by #raiph's link, however, I decided to create a soft link. Now the package works well.

How to add an underscore mixin library to WebStorm?

In my work, we have a file with utilities functions that are extended in _.mixin() function at runtime. No, I cannot change the framework, because the solution would be to separate those function from _.mixin() and make them and indepent module, that would be the best.
Either way, my problem is that I cannot link this file, with all the extended functions in WebStorm, so I always see Unresolved function or method warning
Yes I have tried to add the file in the Library tab under Libraries & Framework preferences. And it did nothing.
So my question is, It is possible to WebStorm (or other Atlassian software) to link a file with several functions that will be extended with Underscore.js _.mixin() function to show up in Autocomplete?
Thanks, in advance
Adding the file to JavaScript libraries won't help here. _.mixin() dynamically adds passed utility functions to _ object, it's not possible to resolve such dynamically generated stuff during static code analysis unless a special treatment for the certain functions is provided. And WebStorm doesn't provide any special support for _.mixin().
If you miss it, please feel free to create a feature request in youtrack, https://youtrack.jetbrains.com/issues/WEB

Intellij - Find path to src directory

I am creating an IntelliJ plugin and I am using JavaParser for one of my features. My plugin will allow users to click a gutter icon next to a method and automatically navigate to the tests associated with that method.
To achieve this, temporerily I have used the line:
typeSolver.add(new JavaParserTypeSolver(new File("/home/webby/IdeaProjects/project00/src/")));
My problem is that I need to pass the source folder of the given module into this type solver. Is there any way I can find the source folder programmatically? Perhaps from an actionEvent?
I have tried things along the lines of the following:
actionEvent.getData(PlatformDataKeys.PROJECT).getBasePath()
This gives me: '/home/webby/IdeaProjects/project00/' but I'm struggling to see how I can get the source folder? I feel there should be a fairly straight forward way of doing this using IntelliJ's SDK but I have not found anything in the documentation or anywhere else online.
Any and all solutions welcome!
Many Thanks,
James
You can use
ModuleRootManager.getInstance(module).getSourceRoots()
to access sources roots of a module. Refer to IntelliJ SDK Docs for details.
BTW IntelliJ IDEA provides special API to syntax trees of Java files, it works more efficiently and better integrates with other IDE features than external JavaParsers.
And it's better to ask questions about IntelliJ IDEA API on a special forum.

Find child plug-ins of features in eclipse workspace

I want to find all the child plug-ins of a feature ? I know the name of the feature, but IWorkspaceRoot.getProject(String) does not really help me. I get an IProject that I don't know how to convert to a feature object (IFeature ?). Maybe I am on the wrong track and there is a better / easier way to do this. Any ideas ?
You could check that a selected IProject is a feature project by checking for the nature called org.eclipse.pde.FeatureNature.
Then you could try to use IProject.getAdapter(IFeature.class) call, the cast the result to IFeature. I did not try this with feature projects, but works well with Java projects.
The correct answer is the use of PDECore static class. This class provides a FeatureModelManager, that would provide the corresponding information:
FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager();
How to obtain this information? I looked with the plug-in spy to find which project defines the 'Deployable Features' export wizard (use Alt+Shift+F3 when the wizard is selected), and then looked at the implementation of the wizard class, where the addPages() method contains the previously described code block.