No autocompletion of JavaScript code in PhpStorm html files [duplicate] - phpstorm

So after updating PhpStorm from 2017.1 to 2017.2, JavaScript autocomplete stopped working in JavaScript, that is embedded inside of PHP file. Nothing works, not core JS method autocomplete, and not even the most basic declared variable autocomplete.
Any idea what could be wrong?

It's a bug/regression in PhpStorm 2017.2 (https://youtrack.jetbrains.com/issue/WI-36767) and it's fixed for 2017.2.1.
If you wish -- you may install 2017.2.1 EAP build now and not wait until 2017.2.1 final will be officially released: https://blog.jetbrains.com/phpstorm/2017/07/phpstorm-2017-2-1-eap-172-3544/
UPDATE: 2017.2.1 has been released -- https://blog.jetbrains.com/phpstorm/2017/08/phpstorm-2017-2-1-is-here/

Related

Why do I need to enable razor runtime compile? Am I taking crazy pills?

As far as I know I've always been able to update cshtml files and immediately see changes (upon refreshing browser) without having to stop my project.
But as I am creating a new project I see this new option to enable this feature and I'm wondering what it is because, after all, I've always been able to do this. But as far as I can tell it does exactly what it says... as if I wasn't able to do this in the past?
But I also notice now that when I make a change to a razor page, it takes a looot longer to see the update as Visual Studio recompiles the project.
What... is... going... on?
As far as I know I've always been able to update cshtml files and
immediately see changes (upon refreshing browser) without having to
stop my project.
Yes.Before asp.net core 3.0,you could do it by default.After asp.net core 3.0,you could install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package to enable runtime compilation.
1.Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.
2.Update the project's Startup.ConfigureServices method to include a call to AddRazorRuntimeCompilation:
services.AddControllersWithViews().AddRazorRuntimeCompilation();
Reference:
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-5.0&tabs=visual-studio#enable-runtime-compilation-in-an-existing-project
Update:
From asp.net core 3.1,you could select the Enable Razor runtime compilation checkbox in the Create a new ASP.NET Core web application dialog:

WebStorm reports a "missing import" on built-in objects

I've an ES6 project in WebStorm which obviously sometimes uses some built-in objects like Math or JSON.
Both HTML / ECMAScript 5 and ECMAScript 6 are enabled in "Settings/(...)/JavaScript/Libraries", yet WebStorm still suggests that Math and JSON are missing imports.
When I create an empty new project it works fine. I also noticed that when selecting JSON in such new project and pressing CTRL+B, WebStorm shows definitions from its internal library.
To the contrary in my main project it shows some TypeScript ones from completely unrelated part of the project. If I move the folder with typescript outside the project it seems to work.
Nota bene, the file I have errors in is not written in TypeScript, does not include anything TypeScript related and is not processed with TypeScript in any way. It is only processed with ES6 to ES5 transpiler.
This worked for me:
Navigate Settings -> Languages & Frameworks -> Node.js and NPM
Click Enable for Node.js Core library under Coding Assistance section
Click Apply
I restarted WebStorm and warnings went away.
Marking the directory with TypeScript based subproject as excluded (right click → “Mark Directory as” → “Excluded”) solves the problem without need to physically remove it from the project.
I had the same issue and I found the solution:
For me it was because I had a ECMA 5.1 project with a subfolder in ECMA 6.
Just invert it: Set all ECMA 5.1 files in ECMA 5.1 and set the main project version to ECMA 6.

TagHelpers Intellisense not working with dnx46 in vNext beta8

I am not able to get TagHelpers Colorization and Intellisense to work in ASP.NET vNext WebToolsExtensionsVS14 Beta 8 when using the dnx46 framework.
NOTE: The project does build, run and TagHelpers are correctly processed on the server. This issue only affects design-time.
Steps I used:
File >> New Project - with the default project options (using .Net Framework 4.6) and Web Application template:
View the _Layout.cshtml, _ViewImports.chhtml, and project.json as follows:
Colorization and Intellisense is working
Modify the project.json frameworks from "dnx451" to "dnx46" and save. Allow the references to update. Close the _Layout.cshtml. Rebuild the solution.
View the _Layout.cshtml:
Colorization and Intellisense NOT working
Questions:
Is anyone else having this issue?
Has anyone figured out a work around?
Known issue. It's being tracked here
This issue has been resolved in the RC1.
https://docs.asp.net/en/latest/getting-started/installing-on-windows.html

phpstorm unresolved function or method $()

I have the following problem: phpstorm do not recognize jquery methods and here and there I see
Unresolved function or method $()
This was bugging me for sometime but finally I tried to get rid of it with File->Settings->JavaScript->Libraries and adding jquery as a global / project.
My library setup looks like this:
But is has not changed anything. I still see those pesky notices. Does anyone know how to get rid of them?
There is a really stupid workaround,
Download the Library (in this case jQuery) from inside the IDE itself.
Open up settings (Ctrl + Alt + S on Linux)
Navigate to Languages & Frameworks -> Javascript -> Libraries
Click Download and choose jQuery
Hopefully the errors will vanish
EDIT:
After running the IDE through Fiddler, I realised this only solves the problem because of the version the IDE downloads.
So, the correct workaround is to Add older, non-AMD jQuery versions as a Global scoped Library and add the latest one as a Project scope library.
The latest non-AMD versions are:
1.10.2 for 1.x series. And, 2.0.0 for 2.x series.
I had the same issue with version 1.11.2, and resolved it simply by adding the uncompressed version into my js folder.
Just copy the uncompressed version of jQuery into your project folder.
you don't even need to import it into your project, just copy it to javascript folder.
The jQuery v1.11.0 shows exactly the same behaviour here as well. At the same time previous version 1.10.2 works fine in IDE (no warnings).
I think it has something to do with "AMD-fy jQuery source" ticket (http://bugs.jquery.com/ticket/14113) -- looks like IDE has some issues figuring out this style.
If you wish (and can) -- roll back to jQuery v1.10.2 (which is like half a year old, which means it's stable and still good to use).
Hopefully IDE will be able to properly parse this new jQuery style in next release.
Actual ticket: http://youtrack.jetbrains.com/issue/WEB-10908
If you import both 1.11.0 and 1.10.2 in phpstorm it will be resolved
You don't have to rollback your project.

Using Compass in PHPStorm 7

So i'm using brand new PHPStorm 7, which is supposed to have full Compass support, with syntax highlighting and stuff.
I successfully install compass to my project directory, PHPStorm offers me to use compass sass watcher, automatically finds compass.bat and my config.rb .
And then, nothing happens - my #import "compass" still triggers unable to resolve import from watcher, i don't get any code completion or search features. The only solution i know was an old trick of adding compass stylesheets directory as a resource root to my project.
So what i'm asking - is this the way it's supposed to be, or am i doing anything wrong, because i don't think manually importing a library into every project is a proper way for supposed library support.
After all, there is an issue on Windows.
There's the solution, and it works. Thanks LazyOne.
http://youtrack.jetbrains.com/issue/WEB-9139