Problem with PhpStorm Red Line Under <!DOCTYPE html> - ide

So the problem I'm having is that when I either create a new php project or open one of my old projects, I instantly get a small red line under just the < on the html <!DOCTYPE> tag.
The reason this is a problem is because I cannot open my previews in the IDE to see what my index.html file looks like on the browser.
Here is the picture of what I'm talking about:

Looks as if the textmate bundles are used for file highlighting.
Please open the Settings | Editor | File Types page and make sure that *.html pattern is assigned to HTML file type there:

Related

javadoc: error cannot read Input length = 1 (IntelliJ - no maven) [duplicate]

I know there are plenty of questions about this problem, but no one of the solved it for me! I'm using the Community Edition of IntelliJ and I tried to run JavaDoc through the IDE. Everytime and it doesn't matter fo which file, I run JavaDoc I got the following output:
javadoc: error - cannot read Input length = 1
I already figured out, that it might be an encoding problem... I'm working on a Windows 10 maschine. I already tried the following:
JavaDoc argfile encoding error
Start the terminal from IntelliJ with cmd.exe /K chcp 65001 instead of the default one cmd.exe to set the charset to UTF-8
I also set the project's default charset through the IntelliJ settings to UTF-8 (See: This Guide)
The problem seems to be the javadoc_args file respectively the path to that file... The path is C:\Users\Somebody Müller\AppData\Local\Temp\javadoc_args. Also if I view the file from IntelliJ, all ü characters are replaced by an unknown symbol.
I know that I could generate the documentation through a maven plugin, but I would prefer to do it via the IntelliJ IDE...
Could somebody identify the problem in detail and/or provide a solution or maybe parts of it?
EDIT
skomisa described the situation/behaviour in easy words:
For me the javadoc_args file does not exist! I see it is named in the Javadoc window as an argument to javadoc.exe, and if I click the link its content is shown in a pop up window within Intellij IDEA, but if I check in File Explorer there is no such file. Is this the case for you as well? I have no idea how it gets generated. Also, I created a project in a folder named Müller and the ü was rendered as � within the popup window that showed the content of javadoc_args.
UPDATE 04/12/2018
As skomisa already commented, JetBrains plans to fix this bug in a future version, likely in version 2019.1 (Build 191.2458).
UPDATE 22/02/2019
I know this question is quite old but it seems to be still relevant. I didn't check up to now if JetBrains fixed the bug but a similar one occurred for me when I try to open an JavaFX fxml externally inside of the SceneBuilder. In another post about renaming a Windows 10 user directory I found a possible workaround at least for Windows users! Just create an additional user directory without ü in the path and link to the existing one:
C:
CD\Users
MKLINK /J Müller Mueller
If you now uses the link as directory for project paths it should work fine.
I am unable to generate the Javadoc for a project in Intellij IDEA if the name of the path contains the character ü (u with umlaut). The workaround is to rename the project so that the project directory file path does not contain an umlaut.
To reproduce:
Use the project wizard to create a trivial Java Hello World project where the root directory name contains ü. I used Müller for testing purposes.
Ensure that the class for main() contains valid Javadoc documentation.
Build and run the project to verify that there are no unexpected issues.
Select Tools > Generate Javadoc, specify an empty Output Directory and click OK.
Javadoc creation fails with the error - cannot read Input length = 1 (shown below), and clicking the link to C:\Users\johndoe\AppData\Local\Temp\javadoc_args shows that the ü in the file path is (mis)represented as �, which presumably is the cause of the Javadoc error.
However, once the root directory is renamed from Müller to Muller (to remove the umlaut) the Javadoc creation works:
As a sanity check, rename the project from Muller back to Müller to reintroduce the error:
Notes:
As noted in the comments, the javadoc_args file does not exist, and I see no way to prevent its use during the Javadoc creation process.
Having the project name as Müller is not an issue; it's having ü within the project's file path that causes the problem.
Environment: Windows 10 + Intellij IDEA 2018 3.1 EAP (Ultimate Edition) + Open JDK 10.
I raised a bug report with JetBrains for this: https://youtrack.jetbrains.com/issue/IDEA-202849
Update 11/25/18
There is a workaround for this issue without needing to rename the project's path:
Run Generate Javadoc and let it fail.
Click the link to the file .../javadoc_args shown in the Javadoc window.
Copy and paste the content of the file javadoc_args into a text editor.
Correct any characters that are misrepresented (e.g. change M�ller to Müller).
Save the file using UTF-8 encoding, and the same absolute filename.
Open a Command Prompt window.
Copy the entire javadoc.exe command from the Javadoc window in Intellij IDEA and paste it to the Command Prompt window.
Submit the line that was pasted. It will now work because the project's path is correctly specified in the file javadoc_args.
Today (21-aug-2021) I tried to generate a javadoc but it failed. The error message was:
javadoc: error - cannot read Input length = 1
In my case it referred to the length of the path to the file, which is shown below.
D:\Tecnologia(ytrabajo)ysistemas26sep2020\misiontic2022\U El Bosque\UEB académico\Ciclo 2\Programación Básica\NetBProjects\R5DTO_DAOMVC_GUI
So I shortened the path to the following:
D:\Tecnologia(ytrabajo)ysistemas26sep2020\misiontic2022\NBProjects(m)\R5DTO_DAOMVC_GUI
As one can see, this route is shorter than the first so NetBeans could access it and generate the javadoc.
Note: It is not possible that NetBeans could not read the location because of the following characters: é and á in the words académico and Básica that I used in the first file location. Because, in that location, I tried to generate a JavaDoc in another project located there and NetBeans generated the Doc. So the error is more about the length of the path and the names of the files in the project.

Commenting in IntelliJ for html files gives {# instead of <!--

I have this weird situation in intellij where whenever I try to comment a region in my html file, instead of making the like it used to do, it now makes "{# .. #}" I tried looking online for how to resolve this but did not run across a solution. I'm sure it's some simple configuration. Do you know where I might be able to fix this?
Add'l Details:
- I'm running IntelliJ 15.0.1 on OSX Yosemite.
- It works on my other projects but doesn't work on my projects started with ionic.
Check your File | Settings | Editor | File Types settings (IntelliJ IDEA | Preferences | Editor | File Types on OSX). Likely you have the *.html pattern mapped to a different file type than HTML.
If that is indeed the problem, just add the *.html pattern to the HTML file type and it will pop up a dialog telling where it is assigned now and asking if you want to reassign. Probably you have it assigned to something like the template languages Django & Jinja2 (for Python) or Twig (for PHP).

How to run .html File from WebStorm

We do unit tests via .html files so that we can interact in a web form also. We also just run the dojo test runner.
I have been able to run the .hml file from Aptana but when I try webstorm for the first time, never tried it, love this IDE, I see that when in my .html file the run button at the top is disabled.
So how do I run an .html file that's got markup and javascript from WebStorm and have it come back and hit my debug points inside Webstorm? Does webstorm scrape in what you see in FireFox also or do you have to keep toggling back and fourth such as when you step to the next debug point, tab back to the browser to see the results...or is there a nice way in webstorm to see the markup in runtime at the same time?
All in all I am just trying to get this .html file to run that's got javascript in it and some Dojo runner, etc. in it since I'm using Dojo in this .html file.
Either just open it manually or allow debug from localhost port.
So appearnetly it's not obvious to open a file in WebStorm there is a row of icons that appear in the top right corner of the text editor pane.
You have to hold SHIFT down when clicking the supported/installed browsers icons hidden there, or it will open in the deployment's location (via FTP server settings etc).
Try ALT-F2 for Preview file in... from "View" menu.

Apple Help Authoring

I'm following this guide to public some Apple help. The application I work on has had help built in for years, but it stopped working all of a sudden, and no changes were made to the application plist or any of the help files. We're presuming Apple changed something, so I made sure it met the specifications Apple were requiring. When I say "not working" I mean that our links using NSHelpManager will open the help viewer but bring back a page not found.
Things to check off the list:
There is an anchor with the correct name at the top of the page
The folder structure is a replica of what is in that article linked earlier
We are re-indexing the help pages
We do clear out all of the caches
Here's the code we use to open the help page:
NSString *locBookName = [[NSBundle mainBundle] objectForInfoDictionaryKey: #"CFBundleHelpBookName"];
[[NSHelpManager sharedHelpManager] openHelpAnchor:#"mypage" inBook:locBookName];
In this instance we'd have a page with a <a name="mypage"></a> at the top so it should link correctly. Our scripts are as follows:
hvfix (clears all caches):
rm -rf ~/Library/Caches/com.apple.help*
rm -rf ~/Library/Preferences/com.apple.help*
rm -rf ~/.Trash/*
killall helpd
defaults write com.apple.helpindexer IndexAnchors YES
updatehelpindex.sh (re-generates indexes)
#!/bin/sh
hiutil -C -f MyApp.help/Contents/Resources/English.lproj/MyApp.helpindex
MyApp.help/Contents/Resources/English.lproj/
We do a build, drop the folder into the Applications folder in order to register the application + the help. We even try a restart or logoff/logon and still we get nothing. I know it's a very fiddly process but nothing we try seems to work. All we want to be able to do is use the NSHelpManager to open a help anchor. Undoubtedly this works in 10.6+ as so many other apps do it (some reports suggest it won't work in 10.7/8, but they must be untrue).
Ideas?
EDIT (folder structure):
This is within the MyProj.help folder that's in a sub-directory of the overall Cocoa project called 'help'.
+ Contents
Info.plist
+ Resources
+ shrd
(a bunch of image files)
+ English.lproj
MyProj.helpindex
index.html
+ css
+ pgs
+ gfx
And in the folders are precisely what's as expected, 'css' has a bunch of CSS files in it, 'pgs' has the HTML pages and 'gfx' has image files.
It appears to be a bug in the way sandboxing affects the HelpViewer's directory search when a HelpBook is registered with the system (as outlined in this bug report), which fully explains why it shows up on 10.7 and 10.8, but not 10.6 and earlier. Even Apple's NSAlertTest suffers from it. Unfortunately, as the bug report remains unsolved as of the time of this post, there is no viable solution, but what few tests I've run have confirmed that NSHelpManager flat-out ignores the sandboxed help plist on my machine.
OK, this one's been quite a roller-coaster of confusion but it has something to do with with your folder structure setup in Xcode. Here's some things worth knowing:
People opt to put it in English.lproj. Don't do this, for a few reasons. First it won't display the sub-directories/files in Xcode if you dragged the help folder into your file listing, and secondly stuff in that folder is supposed to be flat, not structured.
Create a "help" folder in the root and put your files in that. You can then put them in a sub-directory called "English.lproj" if you want localisation.
Don't create a ".help" folder which contains all of your help files. This seems to break indexing. We don't know why.
Instead, have /help/Contents/stuff and drag and drop that folder into your project directory listing (mine's in "Resources" group). Make sure it's a blue folder and that you can see the entire directory (all of your HTML etc.)
Run the help indexer against it to generate the .helpindex file
Make sure your plist entries reflect the name of that folder and the meta tag name specified in your index.html file
If you follow the above rules things should work fine. It seems in ML that creating a .help folder breaks things from here on out, so basically, don't follow the Apple guide.
I am adding this response here because I found a very dumb way of fixing this. By using Apple's hiutil command line tool, I saw that all Apple's official help books use some sort of indexing using a redirector file:
$ hiutil -Df /Applications/Xcode.app/Contents/Resources/Xcode.help/Contents/Resources/en.lproj/search.helpindex
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>dev01043b473</key>
> <array>
> <string>/redirect.html?topic=dev01043b473</string>
> </array>
> <key>dev0125622ec</key>
> <array>
> <string>/redirect.html?topic=dev0125622ec</string>
> </array>
> ...
Inspired by this, I attempted to generate a .searchindex file manually using NSUnarchiver to open the file created by hiutil, changing it, and using NSArchiver to write back to a file, but my anchors would still not work like I wanted.
I cloned TextEdit's help book based on Apple's undisclosed "Eagle" help engine (/Library/Documentation/Resources/Eagle/index.html), which produces the pretty help books all Apple apps use now. But because I was using HTML indexing, my anchors would lead to plain HTML files, which weren't prettified by Eagle.
Then I struck this dumb idea: It's a lot of work, but if you create a separate html file for each anchor, you can use the meta redirect head tag just like in the redirect.html, except your redirects will be static. Therefore, for my editor-prefs.html file, I created a editor-prefs-anchor.html file with the following contents:
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Editor Options</title>
<meta http-equiv="refresh" content="0;url=../index.html?localePath=en.lproj#/editor-prefs" />
</head>
<body>
<a id="editor-prefs">
</body>
</html>
The meta redirect tag takes care of redirecting to the proper Eagle-powered URL, and it works!
If anyone was struggling with Eagle like me, I hope this helps you!
I ran into this same issue (anchors not working in my app's help book) and did some poking around in the help books of other Apple apps, specifically Safari. I found this interesting entry in the Info.plist in the Safari.help bundle in the Safari app:
<key>HPDBookIndexPath</key>
<string>search.helpindex</string>
I changed this to match the name of the .helpindex file in my app's help bundle, and anchors started working.

Intellij Idea problem with text file impossible to read

I have a problem using Intellij Idea.
I am absolutely unable to load text file as InputStream - it doesnt matter where do I put the file (main/java, main/resources...) it just can't find the file - in Eclipse everything works just fine.
I tried setings->compiler->resource patterns and added ?*.txt but that doesn't seem to work either.
Any help is appreciated.
If you load it as a File, make sure that Working Directory is properly set in IDEA Run/Debug Configuration, since it's the default directory where Java will look for a file when you try to access it like new File("file.txt"). Working directory should be set to the directory of your project containing .txt files.
If you load files as a classpath resource, then they should reside somewhere under Source root and will be copied to the classpath according to Settings | Compiler | Resource Patterns.
If you can't get it working, upload your project somewhere including IDEA project files so that we can point to your mistake.
Look at the image, notice that the txt files are in the project root, and not the source folders (in blue).
If you open the Project Structure dialog, and click on Modules and select your module - are the correct folders marked as Source Folders on the sources tab?
Link for how to get to Project Structure dialog
Also, if you print out the absolute path of that file you are trying to read, is that anywhere near where you expect it to be?
An easy way to figure out the same would be to try creating a file in the same fashion and see where it gets created in your project. You can put your input file at the same location and it should work just fine (if it doesn't, you should check your resource pattern which might be causing the file to be not copied over in the build output).
This method actually gives you the working directory of your intellij settings which is pointed out in the accepted answer. Just sharing as I had similar trouble and I figured out this way. :)