From b986087b138c0a923e41e6a15892ca34682b6ae1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 1 Apr 2006 11:47:37 +0000 Subject: [PATCH] Fixed exception when typing Ctrl+Space in Boo Interpreter. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1245 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/CodeCompletionData.boo | 12 ++++++------ .../Project/InterpreterWrapper.boo | 7 ++++++- .../Misc/CodeAnalysis/Src/AnalysisProjectOptions.cs | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/CodeCompletionData.boo b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/CodeCompletionData.boo index e9ef61d1f6..1412476953 100644 --- a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/CodeCompletionData.boo +++ b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/CodeCompletionData.boo @@ -97,7 +97,7 @@ internal class CodeCompletionData(AbstractCompletionData): _entities.Add(entity) internal class GlobalsCompletionDataProvider(ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.AbstractCompletionDataProvider): - _interpreter as InteractiveInterpreter + _interpreter as InterpreterWrapper class GlobalCompletionData(AbstractCompletionData): @@ -107,25 +107,25 @@ internal class GlobalsCompletionDataProvider(ICSharpCode.SharpDevelop.DefaultEdi [getter(Description)] _description as string - def constructor(name, imageIndex, description): + def constructor(name as string, imageIndex as int, description as string): super(name) _imageIndex = imageIndex _description = description - def constructor(interpreter): + def constructor(interpreter as InterpreterWrapper): _interpreter = interpreter override def GenerateCompletionData(fileName as string, textArea as TextArea, charTyped as System.Char) as (ICompletionData): - globals = _interpreter.globals() + globals = _interpreter.GetGlobals() data = array(ICompletionData, len(globals)) for index, key in enumerate(globals): value = _interpreter.GetValue(key) delegate = value as System.Delegate - if delegate is null: + if delegate is null: if value is not null: description = "${key} as ${InteractiveInterpreter.GetBooTypeName(value.GetType())}" else: - description = "null" + description = "null" item = GlobalCompletionData(key, ClassBrowserIconService.FieldIndex, description) else: item = GlobalCompletionData(key, ClassBrowserIconService.MethodIndex, InteractiveInterpreter.DescribeMethod(delegate.Method)) diff --git a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo index d9550ca13d..cc01081972 100644 --- a/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo +++ b/src/AddIns/BackendBindings/Boo/Boo.InterpreterAddIn/Project/InterpreterWrapper.boo @@ -35,4 +35,9 @@ class InterpreterWrapper: // David: the code completion items have to be passed as strings; // but it's not important, you can return null if you want. return _interpreter.SuggestCodeCompletion(code) - + + def GetGlobals(): + return _interpreter.globals() + + def GetValue(variableName as string): + return _interpreter.GetValue(variableName) diff --git a/src/AddIns/Misc/CodeAnalysis/Src/AnalysisProjectOptions.cs b/src/AddIns/Misc/CodeAnalysis/Src/AnalysisProjectOptions.cs index def891d6dc..6f28fe341f 100644 --- a/src/AddIns/Misc/CodeAnalysis/Src/AnalysisProjectOptions.cs +++ b/src/AddIns/Misc/CodeAnalysis/Src/AnalysisProjectOptions.cs @@ -379,13 +379,14 @@ namespace ICSharpCode.CodeAnalysis string[] GetRuleAssemblyList(bool replacePath) { List list = new List(); + string fxCopPath = FxCopWrapper.FindFxCopPath(); foreach (string dir in ruleAssemblies.Split(';')) { if (string.Equals(dir, "$(FxCopDir)\\rules", StringComparison.OrdinalIgnoreCase)) continue; if (string.Equals(dir, "$(FxCopDir)/rules", StringComparison.OrdinalIgnoreCase)) continue; - if (replacePath) { - list.Add(Regex.Replace(dir, @"\$\(FxCopDir\)", FxCopWrapper.FindFxCopPath(), RegexOptions.CultureInvariant | RegexOptions.IgnoreCase)); + if (replacePath && !string.IsNullOrEmpty(fxCopPath)) { + list.Add(Regex.Replace(dir, @"\$\(FxCopDir\)", fxCopPath, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase)); } else { list.Add(dir); }