Anybody know why IntelliJ Idea Ultimate doesn't like Ruby hash literals in the newer syntax? Refer to the red underlines in my screenshot from the IDE below. Syntax:
{key1: "value", key2: 123}
Really annoying as it means my entire project has a red underline all the way up the directory tree.
I have setup a Ruby SDK version greater than 1.9 (which is when i think the new hash literal syntax was introduced) in the IDE preferences, so there is no excuse!
Thanks.
How I fixed this in Intellij 14.1:
File -> Project Structure
Delete the existing module which defaulted to Java (doesn't delete the actual files)
Use green + button to create a new module with same name/location, but this time associated with Ruby on Rails instead of Java (with correct SDK)
File -> Close Project
Reopen project.
Previously I tried just changing the project SDK from the default of Java to Ruby, but this didn't fix the issue.
Under OSX IntelliJ 14 I was able to fix this by closing the project and reopening it.
In fairness, I did try setting the project's "language level", but it only shows Java SDKs, which shouldn't affect my main Ruby module.
This seems to be a bug in the Ruby plugin: http://devnet.jetbrains.com/thread/457333
Anyone who doesn't feel like changing his code base, the following steps resolved the issue for me:
Open File -> Project Structure
Open the Project Tab
Change the Project Language Level
Click OK
IntelliJ now asks if you would like to reload your project. After doing so the "new" Hash Syntax is considered correct...
Edit: It doesn't really matter what you select as language level as it is only relevant for Java code, but apparently this triggers something in the code parser...
What helped me in my case:
Open File -> Project Structure
Remove current using module
Import module ( set path to your project)
Intellij did rest for me
dsager's answer no longer works in Intellij Idea 14. I believe they added the ability to switch language levels without having to reload (great for java development, but breaks this). It's a lame workaround, but the only way I have found now is to create a new ruby project and then move all of your existing sources into it. Something like the following:
PROJECT=my_project
cp -lr $PROJECT ${PROJECT}2
rm -rf ${PROJECT}2/.idea ${PROJECT}2/*.iml
Create new ruby project 'my_project' with appropriate SDK, then:
mv ${PROJECT}2 $PROJECT
Side note: They made Idea's 'Open' command more flexible in 14 in that you can open any directory... much like that of RubyMine. It's quite convenient for opening anything that's not a java project, but this one is annoying.
Answer is to replace every usage of the horrible new hash syntax with the old one using a regex (not perfect yet but works ~95% of the time).
files=gfind . -iregex '.*\(rb\|haml\)' -printf '%p\n'
for file in $files
do
gsed -i "s/([a-z_]+):{1}\s+(('\|"'"'")\?[-a-zA-Z0-9{}:#]+('\|"'"'")\?)/:\1 => \2/g" $file
done
Related
After finding a number of articles that describe using Apple's Swift for scripting purposes, I wanted to try my hand at it. I want to do some simple scripts that perform actions on the file system: moving things around, renaming things, and so on.
My preferred text editor is Sublime, and while there is a package for Swift syntax, you obviously don't get any kind of autocomplete. Alternatively, I could use Xcode, which historically has had awesome autocomplete. From the command-line, I can type open myFile.swift to pop open an Xcode editor window for that file.
However, when I do this there's no autocomplete. I fear that I need to have a whole Xcode project set up with a build target, etc. to get autocomplete going...is this the case?
Does anyone know a simple way to get Swift autocomplete in Xcode (or Sublime) for scripting purposes? Thanks!
You should try using a playground in XCode if you don't need to reference other files. This lets you perform some basic debug as well.
After checking the help command with swift package --help I noticed about the generate-xcodeproj subcommand:
generate-xcodeproj Generates an Xcode project
So, you can generate an Xcode project doing swift package generate-xcodeproj and benefit the awesome autocompletion that Xcode gives you, even using dependencies.
Just generate and open the project file. Resolving new package dependencies will not update the project, so you need to rerun the generate-xcodeproj command on every dependencies change.
I got a Rails Project in intellij idea but somehow the language level seems to be set on 1.8. I got the following configuration:
But it still shows the following error:
Am I missing something? When I had problems with the colon syntax before, it was always the language level.
Thanks,
Robin
I still don't know what the problem exactly was but I guess it had something todo with binstubs. What I did:
I opened the project in RubyMine, where I got the warning: "no ruby interpreter configured for the project", though the correct rvm ruby was selected
I deleted the .idea folder and the bin folder
I opened the project in RubyMine again, this time it correctly recognised the rvm ruby
I opened the project in Intellij IDEA, everything works fine here too.
The answer is given by rweng:
Remove .idea folder
File/New/ProjectFromExistingSources
Maybe deleting the module and recreating the same might also help
I just downloaded and compiled Pantomime for SMTP use in my Cocoa Application. The first issue was that it is old... so I changed the build settings to use the most recent SDK as well as eliminate the old PPC build settings.
After those changes, everything compiled nicely (or at least appeared to do so.)
Next, I installed the Pantomime.framework into the /Library/Frameworks directory per Apple documentation recommendations.
Then, I imported the framework into my project under the Build Phases tab where it says "Link Binaries to Libraries".
So far everything seemed to work as it did with WebKit.framework, and ScriptingBridge.framework.
Finally, I added the following to my code:
#import <Pantomime/Pantomime.h>
I got as far as "Pa" when it auto completed the rest, so it apparently knows what I'm looking for. However, when I try to compile my code, I receive the following error:
Lexical or Preprocessor Issue "Pantomime/Pantomime.h" file not found.
All of the other frameworks seemed to work, but this one does not, and I really don't know why (I'm relatively new to working with frameworks.)
Anyone have any ideas on what I'm doing wrong here?
Thanks!
I've never used Pantomime, but this happens to me all the time with Xcode, so although I'm a newbie to development in general I'd wager it's just a bug with Xcode. Here's how I fix it:
In Xcode, hit command-1 to switch to the Navigator's file/folder view.
Reveal the Pantomime.h and .m files in the Finder, wherever you've stored them.
Drag them into the Navigator.
Xcode will prompt you to confirm adding again, and I usually leave it set as is to "copy files if needed".
Xcode will import. You should then delete the old references in the Navigator. It should work fine after that.
I have met this problem.
The solution is setting 'Build Settings' --> 'Header Search Path' Value where your pantomime is. Good luck!
I've tried to use MonoDevelop 2.4 and 2.6 with Ubuntu 11.04, but neither of them seems to actually provide any way of running the project. (As the picture shows, the Run, Step, and Debug items are disabled -- both on the toolbar and inside the menus.)
This is true for all project types I've seen so far -- C#, Python, etc...
But mono-debugger is installed. Is there some post-setup task that I need to do manually, for this to work?
Looking over https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
Perhaps you haven't selected a 'Project'? Open up the Solution pad and click on the Test1 project (not the solution at the root of the tree, but the project just below it).
I'm just guessing here since I don't have Ubuntu and can't actually test anything.
Edit: actually, it looks like clicking on the Solution would work as well.
From looking at the code, another possibility is that you don't have a build target? Not sure how that would happen, but unless you only opened Main.cs and not actually Test1.sln, I don't know what to suggest.
When you opened the project, which file did you open? Test1.sln? Test1.csproj? Or Main.cs?
Try looking for mono-mdb and more packages in synaptic, this may fix this issue.
Don't remember exact names, Linux box at home...
Did you really open the project? It looks like you just opened Main.cs. It won't work that way.
Make sure you installed the compilers (mcs etc)
Is there any GUI based debugger for Ruby? Just a debugger. I do not want a full IDE like NetBeans because they tend to get your project dirty with extra files.
thanks!
Check out Mr. Guid, which uses GTK+ and is cross-platform.
In netbeans you can tell it to put the netbeans project files in a separate directory or you can easily ignore the nbproject directory with your project's vcs. Netbeans has by far the best integrated debugging I have seen and there are many other great reasons to give it a try. Don't worry about netbeans using a project folder. I highly doubt you'll be able to find a better free GUI debugger.
If the code completion stuff gets in your way with netbeans it is easy to turn off and only request code completion when you want it (ctrl+space). That was my biggest gripe with netbeans.
I haven't used it in about a year, but I liked Arachno Ruby