Browse files

use GHC's suggestions

  • Loading branch information...
1 parent 765f5f7 commit a2d848b49c5237d707a9bacdfaf58b1a0d79a0e9 @JPMoresmau committed Nov 6, 2012
View
4 docs/releasenotes/net.sf.eclipsefp.haskell_2.3.3.txt
@@ -10,12 +10,14 @@ Necessary Haskell packages:
Fixes:
-
+ - Synchronizes new projects correctly if not in auto build mode
+ - Adds proper import even if GHC suggested alternative
Features:
- Evaluate GHCi expressions in debug mode even when not stopped at a breakpoint
- Can specify paths of executables in preferences for Alex, Happy and UUAGC
- File templates for cabal file, setup.hs, new modules... (under Preferences -> Haskell -> New Project)
+ - Offers GHC suggested alternative on unresolved symbol
Internal:
View
1 ...efp.haskell.buildwrapper/src/net/sf/eclipsefp/haskell/buildwrapper/types/GhcMessages.java
@@ -36,6 +36,7 @@
public static String NOT_IN_SCOPE_START="not in scope: "; //$NON-NLS-1$
public static String NOT_IN_SCOPE_END="'"; //$NON-NLS-1$
+ public static String NOT_IN_SCOPE_SUGGESTION="perhaps you meant"; //$NON-NLS-1$
public static String IS_A_DATA_CONSTRUCTOR="is a data constructor"; //$NON-NLS-1$
View
16 ...l.ui/src/net/sf/eclipsefp/haskell/ui/internal/resolve/BuildMarkerResolutionGenerator.java
@@ -135,6 +135,19 @@ else if (msgL.indexOf(GhcMessages.MISSING_MODULE)>-1){
// Not in scope
else if (msgL.indexOf( GhcMessages.NOT_IN_SCOPE_START )>-1){
int start = msgL.indexOf( '`',msgL.indexOf( GhcMessages.NOT_IN_SCOPE_START ));
+ int l=msgL.indexOf( "\n",start+1 );
+ String suggestion=null;
+ if (l>-1){
+ String sug=msg.substring( l );
+ int startSug = sug.indexOf( '`');
+ if(startSug>-1){
+ int endSug=sug.lastIndexOf( GhcMessages.NOT_IN_SCOPE_END );
+ if (endSug>-1){
+ suggestion=sug.substring(startSug+1,endSug);
+ }
+ }
+ msgL=msgL.substring( 0,l );
+ }
int end = msgL.lastIndexOf( GhcMessages.NOT_IN_SCOPE_END );
String notInScope = msg.substring( start + 1, end );
String name, qualified;
@@ -146,6 +159,9 @@ else if (msgL.indexOf( GhcMessages.NOT_IN_SCOPE_START )>-1){
name = notInScope;
qualified = null;
}
+ if (suggestion!=null){
+ res.add( new ReplaceTextResolution( notInScope, suggestion ) );
+ }
try {
if (BrowserPlugin.getSharedInstance().isAnyDatabaseLoaded()) {
//BrowserPlugin.getSharedInstance().setCurrentDatabase( DatabaseType.ALL, null );
View
1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/UITexts.java
@@ -322,6 +322,7 @@
public static String resolve_hlint_replace;
public static String resolve_install_one;
public static String resolve_install_all;
+ public static String resolve_text_replace;
public static String preferences_title;
View
1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/util/uitexts.properties
@@ -339,6 +339,7 @@ resolve_hlint_remove=Remove {0}
resolve_hlint_replace=Replace {0} by {1}
resolve_install_one=Install package {0}
resolve_install_all=Install all missing packages
+resolve_text_replace=Replace {0} by {1}
preferences_title=Preferences for Haskell.\nPlease select a specific feature from the tree.
View
1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/util/HaskellUIImages.java
@@ -119,6 +119,7 @@ private static void declareImages() {
declare(HACKAGE_INSTALL,VIEW+"hackage_install.png");
declare(SEARCH_LINE,OBJECT+"search_ref_obj.gif");
declare(AUTODETECT,OBJECT+"autodetect.png");
+ declare(CORRECTION,OBJECT+"correction.gif");
}
private final static void declare( final String key,
View
1 net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/util/IImageNames.java
@@ -95,4 +95,5 @@
String AUTODETECT= ID+".AUTODETECT"; //$NON-NLS-1$
String SEARCH_LINE=ID+".SEARCH_LINE"; //$NON-NLS-1$
+ String CORRECTION = ID + ".CORRECTION"; //$NON-NLS-1$
}

0 comments on commit a2d848b

Please sign in to comment.