How to enable support for SvelteKit's $lib alias in WebStorm (and PhpStorm, etc)? - webstorm

Is it possible to define a special mapping that enables PhpStorm (or other WebStorm based IDEs) to have the ability to find files located in SvelteKit's special $lib directory alias?
For example, in PhpStorm, I'm importing global styles like so:
<script context="module">
import '$lib/global-styles.scss';
</script>
However, the IDE unfortunately displays "Cannot find declaration to go to" when attempting to navigate to that particular file:

Seems the fix was reasonably easy (inspired by this answer). Just add a path alias to any JS file in the root of your project called .webstorm.js (filename isn't important):
// eslint-disable
System.config({
"paths": {
"$lib/*": "./src/lib/*",
}
});
Now navigation to paths under $lib/* should "just work" ✨ automatically. Unfortunately I can't find documentation for this special WebStorm-specific System.config() workaround, the best I could find was this comment on Jetbrains' issue tracker.

Related

Eclipse C++: fatal error: cheddar.h: no such file or directory

[RHEL v7.3, Eclipse Photon, C/C++ Project with Eclipse-generated Makefile]
Attempting to include a custom library named cheddar.h results in
Fatal Error: cheddar.h: no such file or directory
Research 1 and 2 suggests manually adding the include path by first alt-clicking the project in Project Explorer, and then manually adding the path :
Properties -> C/C++ General -> Paths and Symbols : Includes : Languages, GNU C++
No luck.
It works if I do things the old-fashioned way, and add the path to the makefile with a -I option, like so
-I/home/kmiklas/lib/
..but I feel like I'm working-around the issue, and I want this set up properly; the way it should be set up.
How do I correctly specify a custom include path in Eclipse? Tyvm :^)
What is wrong with CMake/Makefile?
I don’t know, but this just sounds like an XY problem. But what’s even more confusing is how you’re so reluctant to use a solution that you’ve already got (as in it’s bugging me).
Anyway
What may aid you in this is to ditch eclipse’s settings and just use the compiler’s. Eclipse uses (GCC/G++ (probably)). What you can do is set some environment variables DUN DUN DUHH!
These environment variables are aptly named: C_INCLUDE_PATH and CPLUS_INCLUDE_PATH. If, however, you want the same for both (you want to use it for both languages) you can just set CPATH.
You’re probably thinking: what else can I do with this marvel... and for that I direct you to the official GCC website.

WebStorm: configure Prettier to use tabs?

The Prettier docs say to use --use-tabs to override the default behavior. WebStorm automatically populated the Prettier package:
That's a folder. I tried changing it to npm\prettier.cmd and adding the switch, but that doesn't work (It just turns red).
How can I set WebStorm to use tabs with Prettier?
If your project has a .editorconfig file, you can override the indent_style setting in there.
# top-most EditorConfig file
root = true
[*]
indent_size = 4
indent_style = tab
I found these resources helpful too:
https://prettier.io/docs/en/options.html#tabs
https://editorconfig.org/
Due to https://github.com/prettier/prettier/pull/2434 fix, Prettier (even global!) uses configuration file nearest to current file (up the directory tree) when formatting.
So, you can install it globally and configure it in your project, by adding the corresponding .prettierrc file or "prettier" section in project package.json.

On Eclipse, is there a way to modify several include paths in one shot?

I'm trying to change the include paths from relative path to fixed path. Is there a way to do it in a bulk? Or do I need to manually edit one by one?
I'm currently going to
C/C++ Build -> Settings -> ** Compiler -> Includes
And have to manually edit the path from something like:
../../../../../platform/hal/rtc
../../../../../platform/hal/sai
../../../../../platform/hal/sim
To
"C:\Freescale\KSDK_1.0.0/platform/hal/rtc"
"C:\Freescale\KSDK_1.0.0/platform/hal/sai"
"C:\Freescale\KSDK_1.0.0\platform\hal\sim\"
I wonder if there's a way to export this to an XML file or something and then import it.
Thank you!
I've had this issue before in a workspace that contains more than 40+ similar C++ projects. The way I deal with it is to write a shell script that modifies the .cproject files on disk:
Use find to recursively find the .cproject files that I need to modify.
Use sed to search and replace inside each file using sed s/find-expression/replace-expression/g < .cproject > .cproject.tmp.
When I'm happy that the .cproject.tmp files contain the correct replacements then I add mv .cproject.tmp .cproject to the script to finalise the operation.
Since you're using Windows you'll need to get your projects into an environment where shell-scripting is easy - cygwin or msys are both powerful enough to do this.
In C/C++ General -> Paths and Symbols -> Includes ... (then possibly your language), there is an export settings button which has a checkbox which includes the includes path. To import these settings into another project, you would use the import settings button when you open the properties to the same place in another project.

Android Action bar

I am trying to demo the Android Action Bar and have created an app to try it with. I have installed and linked the library to the project ( I think properly ), and have to the best of my knowledge set it up correctly. The problem though, is that the MainActivity fails to load any of the main resource files.
MainActivity layout:
Create field 'activity_main' in type 'layout'
Menu xml file:
Create field 'menu' in type 'R'
The theme in the Manifest:
No resource found that matches the given name ( at 'theme' with a value
'#style/Theme_appCompat_Light_DarkActionBar')
The main layout and the menu xml both exist, but I admit i don't know where the theme file is to confirm that it exists, though I don't think that is the issue.
I have taken a screenshot that shows the configuration of my projects
The test application and the appcompat folders exist in the same place in the file system, and the build path and library entries all look correct. I can attach screens of those configurations as well if need be.
I feel that this is some kind of configuration error, but i am very new to android development and don't have enough information about the project structure to see where I need to make a change.
Any help would be greatly appreciated.
There seems to be an error in your AndroidManifest.xml. Eclipse won't generate the R ( references file) file until there are no errors in your xml files.
You'll also need the android-support-v13.jar library as that would have some themes in there as well.
If that doesn't work for the theme in the Manifest, you'll need an appropriate themes.xml in your values folder that has the theme name you're looking for. Here's an example:
<!--
the theme applied to the application or activity
-->
<style name="CustomLightTheme" parent="#android:style/Theme.Holo.Light">
</style>

Eclipse spelling engine does not exist

I'm using Eclipse 3.4 (Ganymede) with CDT 5 on Windows.
When the integrated spell checker doesn't know some word, it proposes (among others) the option to add the word to a user dictionary.
If the user dictionary doesn't exist yet, the spell checker offers then to help configuring it and shows the "General/Editors/Text Editors/Spelling" preference pane. This preference pane however states that "The selected spelling engine does not exist", but has no control to add or install an engine.
How can I put a spelling engine in existence?
Update: What solved my problem was to install also the JDT. This solution was brought up on 2008-09-07 and was accepted, but is now missing.
The CDT version of Ganymede apparently shipped improperly configured. After playing around for a while, I have come up with the following steps that fix the problem.
Export your Eclipse preferences (File > Export > General > Preferences).
Open the exported file in a text editor.
Find the line that says
/instance/org.eclipse.ui.editors/spellingEngine=org.eclipse.jdt.internal.ui.text.spelling.DefaultSpellingEngine
Change it to
/instance/org.eclipse.ui.editors/spellingEngine=org.eclipse.cdt.internal.ui.text.spelling.CSpellingEngine
Save the preferences file.
Import the preferences back into Eclipse (File > Import > General > Preferences).
You should now be able to access the Spelling configuration page as seen above.
Note: if you want to add a custom dictionary, Eclipse must be able to access and open the file (i.e. it must exist - an empty file will work)
Are you using the C/C++ Development Tools exclusively?The Spellcheck functionality is dependent upon the Java Development Tools being installed also.The spelling engine is scheduled to be pushed down from JDT to the Platform,so you can get rid of the Java related bloat soon enough. :)
Just a word of warning: If you follow the advice to replace the preference as above, it will affect spell checking if you also use Java. I think all I needed to do was change the "Select spelling engine to use" to the C++ engine (near the top of the preference setting on the preference page General->Editors->Text Editors->Spelling).