import org.simantics.scl.compiler.environment.LocalEnvironment;
import org.simantics.scl.compiler.environment.specification.EnvironmentSpecification;
import org.simantics.scl.compiler.errors.CompilationError;
+import org.simantics.scl.compiler.errors.ErrorSeverity;
import org.simantics.scl.compiler.module.repository.ImportFailure;
import org.simantics.scl.compiler.module.repository.ImportFailureException;
import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
// at the very start of the editor
List<CompilationError> errors = new ArrayList<CompilationError>();
for (ImportFailure failure : cause.failures) {
- errors.add(new CompilationError(0, failure.toString()));
+ errors.add(new CompilationError(0, failure.toString(), ErrorSeverity.IMPORT_ERROR));
}
return new ComponentTypeScriptResult(errors, null);
}
import org.simantics.scl.compiler.environment.Environment;
import org.simantics.scl.compiler.environment.EnvironmentFactory;
import org.simantics.scl.compiler.environment.Environments;
+import org.simantics.scl.compiler.errors.CompilationError;
import org.simantics.scl.compiler.errors.ErrorLog;
+import org.simantics.scl.compiler.errors.ErrorSeverity;
import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
import org.simantics.scl.compiler.internal.codegen.effects.ThreadLocalVariable;
compilationContext.environment = new EnvironmentOfModule(importedEnvironment, module);
} catch (ImportFailureException e) {
for(ImportFailure failure : e.failures)
- errorLog.log(failure.location, failure.toString());
+ errorLog.log(new CompilationError(failure.location, failure.toString(), ErrorSeverity.IMPORT_ERROR));
return;
}
for(ImportDeclaration importAst : importsAst)
int constructorTag = 0;
for(Constructor constructor : dataType.constructors) {
SCLValue value = new SCLValue(constructor.name);
+ value.definitionLocation = constructor.loc;
SCLConstructor sclConstructor =
new SCLConstructor(
constructor.name.name,
Namespace childNamespace = namespace.getNamespace(prefix.substring(0, p));
if(childNamespace != null)
findValuesForPrefix(childNamespace, prefix.substring(p+1), proc);
+ else
+ namespace.findValuesForPrefix(prefix, AcceptAllNamespaceFilter.INSTANCE, proc);
}
else
namespace.findValuesForPrefix(prefix, AcceptAllNamespaceFilter.INSTANCE, proc);
public void log(CompilationError error) {
errors.add(error);
- if(error.severity == ErrorSeverity.ERROR)
+ if(error.severity != ErrorSeverity.WARNING)
++errorCount;
}
package org.simantics.scl.compiler.errors;
public enum ErrorSeverity {
- ERROR,
- WARNING
+ ERROR,
+ IMPORT_ERROR,
+ WARNING
}
reg.put("find", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/find.png") );
reg.put("disk", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/disk.png") );
reg.put("error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/error.png") );
+ reg.put("import_error", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/import_error.png") );
reg.put("warning", Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/warning.png") );
}
private final SCLCompletionType completionType;
public SCLCompletionProposal(SCLValue value, int replacementOffset, String prefix) {
- this.name = value.getName().name;
- this.module = value.getName().module;
+ String tempName = value.getName().name;
+ String tempModule = value.getName().module;
+ int p = tempName.lastIndexOf('.');
+ if(p >= 0) {
+ tempModule = tempModule + "." + tempName.substring(0, p);
+ tempName = tempName.substring(p+1);
+ }
+ this.name = tempName;
+ this.module = tempModule;
this.documentation = value.getDocumentation();
this.content = name + " :: " + value.getType() + " (" + module + ")";
this.replacementOffset = replacementOffset;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
+import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.module.InvalidModulePathException;
import org.simantics.scl.compiler.module.ModuleUtils;
import org.simantics.scl.compiler.source.ModuleSource;
SCLTextEditorEnvironment editorEnvironment = moduleEditor.getSCLTextEditorEnvironment();
editorEnvironment.updateEnvironment(moduleEditor.getDocument());
SCLValue value = editorEnvironment.getValue(identifierAtCaret);
+ System.out.println("identifierAtCaret = " + identifierAtCaret + " [" + Locations.beginOf(value.definitionLocation) + ", " + Locations.endOf(value.definitionLocation) + "]");
if(value != null)
OpenSCLDefinition.openDefinition(value);
}
SCLIssuesTableEntry entry = (SCLIssuesTableEntry)element;
return entry.error.severity == ErrorSeverity.ERROR
? imageRegistry.get("error")
+ : entry.error.severity == ErrorSeverity.IMPORT_ERROR
+ ? imageRegistry.get("import_error")
: imageRegistry.get("warning");
}
});