Browse Source

Merge branch 'master' of github.com:icsharpcode/SharpDevelop

pull/505/merge
Peter Forstmeier 11 years ago
parent
commit
3acbe6cce0
  1. 2
      src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin
  2. 10
      src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj
  3. 170
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs
  4. 26
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpDotCompletionDataProvider.cs
  5. 58
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpExpressionFinder.cs
  6. 62
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs
  7. 68
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpParser.cs
  8. 119
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpResolver.cs
  9. 50
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCompilationUnit.cs
  10. 29
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
  11. 9
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs
  12. 24
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs
  13. 44
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs
  14. 2
      src/AddIns/Debugger/Debugger.AddIn/Pads/AutoCompleteTextBox.cs
  15. 4
      src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs
  16. 2
      src/AddIns/Debugger/Debugger.AddIn/Pads/ConsolePad.cs
  17. 8
      src/AddIns/Debugger/Debugger.AddIn/Pads/DebuggerDotCompletion.cs
  18. 2
      src/AddIns/Debugger/Debugger.Core/Breakpoint.cs
  19. 39
      src/AddIns/Debugger/Debugger.Core/PdbSymbolSource.cs
  20. 4
      src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs
  21. 59
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerToolTipProvider.cs
  22. 20
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  23. 9
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs
  24. 4
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs
  25. 25
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditView.cs
  26. 2
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs
  27. 23
      src/AddIns/VersionControl/GitAddIn/Src/Git.cs
  28. 1
      src/Main/Base/Project/Editor/DocumentationUIBuilder.cs
  29. 86
      src/Main/Base/Project/Editor/ToolTipUtils.cs
  30. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  31. 2
      src/Main/Base/Project/Src/Services/LanguageBinding/DefaultLanguageBinding.cs
  32. 2
      src/Main/Base/Project/Src/Services/LanguageBinding/ILanguageBinding.cs
  33. 1
      src/Main/Base/Project/Templates/ProjectTemplate.cs
  34. 11
      src/Main/Base/Project/Util/SharpDevelopExtensions.cs
  35. 11
      src/Main/Core/Project/Src/Util/CommandWrapper.cs
  36. 7
      src/Main/ICSharpCode.Core.Presentation/Menu/MenuCommand.cs
  37. 3
      src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs
  38. 7
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarButton.cs
  39. 4
      src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs
  40. 12
      src/Main/ICSharpCode.Core.WinForms/Menu/MenuCommand.cs
  41. 2
      src/Main/ICSharpCode.Core.WinForms/Menu/MenuService.cs
  42. 1
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngine.cs
  43. 2
      src/Main/SharpDevelop/Templates/Project/ProjectDescriptor.cs

2
src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin

@ -130,7 +130,7 @@ @@ -130,7 +130,7 @@
</ComplexCondition>
</Path>
<Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<Path name = "/SharpDevelop/ViewContent/TextEditor/CodeCompletion">
<CodeCompletionBinding id = "RazorCSharp" extensions = ".cshtml" class = "ICSharpCode.AspNet.Mvc.Completion.RazorCSharpCompletionBinding"/>
</Path>

10
src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj

@ -134,14 +134,9 @@ @@ -134,14 +134,9 @@
<Compile Include="Src\AddMvcViewToProjectViewModel.cs" />
<Compile Include="Src\BooleanToVisibilityConverter.cs" />
<Compile Include="Src\CloseDialogBehaviour.cs" />
<Compile Include="Src\Completion\RazorCompilationUnit.cs" />
<Compile Include="Src\Completion\RazorCSharpCompletionBinding.cs" />
<Compile Include="Src\Completion\RazorCSharpDotCompletionDataProvider.cs" />
<Compile Include="Src\Completion\RazorCSharpExpressionFinder.cs" />
<Compile Include="Src\Completion\RazorCSharpModelTypeLocater.cs" />
<Compile Include="Src\Completion\RazorCSharpParser.cs" />
<Compile Include="Src\Completion\RazorCSharpParserModelTypeVisitor.cs" />
<Compile Include="Src\Completion\RazorCSharpResolver.cs" />
<Compile Include="Src\CurrentAppDomain.cs" />
<Compile Include="Src\CurrentAppDomainFactory.cs" />
<Compile Include="Src\Folding\CharacterReader.cs" />
@ -285,6 +280,11 @@ @@ -285,6 +280,11 @@
<Name>ICSharpCode.AvalonEdit</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name>

170
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs

@ -16,27 +16,149 @@ @@ -16,27 +16,149 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using ICSharpCode.SharpDevelop.Editor;
//using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpCompletionBinding : DefaultCodeCompletionBinding
// {
// public RazorCSharpCompletionBinding()
// {
// }
//
// public override CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch)
// {
// if (ch == '.') {
// new RazorCSharpDotCompletionDataProvider().ShowCompletion(editor);
// return CodeCompletionKeyPressResult.Completed;
// } else if (ch == '(') {
// return base.HandleKeyPress(editor, ch);
// }
// return CodeCompletionKeyPressResult.None;
// }
// }
//}
using System;
using System.IO;
using System.Web.Razor;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.CSharp.TypeSystem;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
namespace ICSharpCode.AspNet.Mvc.Completion
{
public class RazorCSharpCompletionBinding : ICodeCompletionBinding
{
public bool HandleKeyPressed(ITextEditor editor, char ch)
{
if (ch == '.') {
var binding = CreateBinding(editor);
return binding.HandleKeyPressed(editor, ch);
}
return false;
}
public bool CtrlSpace(ITextEditor editor)
{
return false;
}
public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch)
{
// We use HandleKeyPressed instead.
return CodeCompletionKeyPressResult.None;
}
ICodeCompletionBinding CreateBinding(ITextEditor editor)
{
return SD.LanguageService.GetLanguageByExtension(".cs")
.CreateCompletionBinding(FindExpressionToComplete(editor), CreateContext(editor));
}
string FindExpressionToComplete(ITextEditor editor)
{
int endOffset = editor.Caret.Offset;
int startOffset = endOffset;
while (startOffset > 0 && IsValidCharacter(editor.Document.GetCharAt(startOffset - 1)))
startOffset--;
return editor.Document.GetText(startOffset, endOffset - startOffset);
}
bool IsValidCharacter(char ch)
{
return Char.IsLetterOrDigit(ch) ||
(ch == '.') ||
(ch == '_');
}
ICodeContext CreateContext(ITextEditor editor)
{
var compilation = SD.ParserService.GetCompilationForFile(editor.FileName);
var project = SD.ProjectService.FindProjectContainingFile(editor.FileName);
var resolveContext = new SimpleTypeResolveContext(compilation.MainAssembly);
var currentTypeDefinition = new DefaultUnresolvedTypeDefinition(project.RootNamespace, Path.GetFileNameWithoutExtension(editor.FileName));
ITypeReference baseTypeReference = new GetClassTypeReference("System.Web.Mvc", "WebViewPage", 1);
baseTypeReference = new ParameterizedTypeReference(baseTypeReference, new[] { FindModelType(editor) });
currentTypeDefinition.BaseTypes.Add(baseTypeReference);
var currentMethod = new DefaultUnresolvedMethod(currentTypeDefinition, "__ContextStub__");
currentMethod.ReturnType = KnownTypeReference.Void;
currentTypeDefinition.Members.Add(currentMethod);
var currentResolvedTypeDef = new DefaultResolvedTypeDefinition(resolveContext, currentTypeDefinition);
var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent;
var currentFile = new CSharpUnresolvedFile();
currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc");
currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc.Ajax");
currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc.Html");
currentFile.RootUsingScope.AddSimpleUsing("System.Web.Routing");
currentFile.TopLevelTypeDefinitions.Add(currentTypeDefinition);
if (projectContent != null) {
compilation = projectContent.AddOrUpdateFiles(currentFile).CreateCompilation(SD.ParserService.GetCurrentSolutionSnapshot());
}
var context = new CSharpTypeResolveContext(compilation.MainAssembly,
currentFile.RootUsingScope.Resolve(compilation),
currentResolvedTypeDef,
currentMethod.CreateResolved(resolveContext.WithCurrentTypeDefinition(currentResolvedTypeDef)));
return new CSharpResolver(context);
}
ITypeReference FindModelType(ITextEditor editor)
{
ParserResults results = ParseTemplate(editor.Document);
string typeName = GetModelTypeName(results);
if (string.IsNullOrWhiteSpace(typeName))
return KnownTypeReference.Object;
return new CSharpParser().ParseTypeReference(typeName)
.ToTypeReference(NameLookupMode.BaseTypeReference);
}
ParserResults ParseTemplate(ITextSource textBuffer)
{
var host = new RazorEngineHost(new CSharpRazorCodeLanguage());
var engine = new RazorTemplateEngine(host);
return engine.ParseTemplate(textBuffer.CreateReader());
}
string GetModelTypeName(ParserResults results)
{
var visitor = new RazorCSharpParserModelTypeVisitor();
results.Document.Accept(visitor);
return visitor.ModelTypeName;
}
}
static class NRUtils
{
/// <remarks>Does not support type arguments!</remarks>
public static void AddSimpleUsing(this UsingScope scope, string fullName)
{
if (scope == null)
throw new ArgumentNullException("scope");
string[] parts = fullName.Trim().Split('.');
TypeOrNamespaceReference reference = null;
foreach (var part in parts) {
if (reference != null) {
reference = new MemberTypeOrNamespaceReference(reference, part, EmptyList<ITypeReference>.Instance);
} else {
reference = new SimpleTypeOrNamespaceReference(part, EmptyList<ITypeReference>.Instance);
}
}
scope.Usings.AddIfNotNull(reference);
}
}
}

26
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpDotCompletionDataProvider.cs

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpDotCompletionDataProvider : DotCodeCompletionItemProvider
// {
// }
//}

58
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpExpressionFinder.cs

@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using ICSharpCode.SharpDevelop.Dom;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpExpressionFinder : IExpressionFinder
// {
// public RazorCSharpExpressionFinder()
// {
// }
//
// public ExpressionResult FindExpression(string text, int offset)
// {
// int position = offset - 1;
// while (position > 0 && IsValidCharacter(text[position])) {
// position--;
// }
// position++;
// string expression = text.Substring(position, offset - position);
// return new ExpressionResult(expression);
// }
//
// bool IsValidCharacter(char ch)
// {
// return Char.IsLetterOrDigit(ch) ||
// (ch == '.') ||
// (ch == '_');
// }
//
// public ExpressionResult FindFullExpression(string text, int offset)
// {
// return ExpressionResult.Empty;
// }
//
// public string RemoveLastPart(string expression)
// {
// return expression;
// }
// }
//}

62
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs

@ -16,34 +16,34 @@ @@ -16,34 +16,34 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using System.Web.Razor;
//using ICSharpCode.SharpDevelop;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpModelTypeLocater
// {
// public RazorCSharpModelTypeLocater(ITextBuffer textBuffer)
// {
// ParserResults results = ParseTemplate(textBuffer);
// ModelTypeName = GetModelTypeName(results);
// }
//
// ParserResults ParseTemplate(ITextBuffer textBuffer)
// {
// var host = new RazorEngineHost(new CSharpRazorCodeLanguage());
// var engine = new RazorTemplateEngine(host);
// return engine.ParseTemplate(textBuffer.CreateReader());
// }
//
// string GetModelTypeName(ParserResults results)
// {
// var visitor = new RazorCSharpParserModelTypeVisitor();
// results.Document.Accept(visitor);
// return visitor.ModelTypeName;
// }
//
// public string ModelTypeName { get; private set; }
// }
//}
using System;
using System.Web.Razor;
using ICSharpCode.NRefactory.Editor;
namespace ICSharpCode.AspNet.Mvc.Completion
{
public class RazorCSharpModelTypeLocater
{
public RazorCSharpModelTypeLocater(ITextSource textBuffer)
{
ParserResults results = ParseTemplate(textBuffer);
ModelTypeName = GetModelTypeName(results);
}
ParserResults ParseTemplate(ITextSource textBuffer)
{
var host = new RazorEngineHost(new CSharpRazorCodeLanguage());
var engine = new RazorTemplateEngine(host);
return engine.ParseTemplate(textBuffer.CreateReader());
}
string GetModelTypeName(ParserResults results)
{
var visitor = new RazorCSharpParserModelTypeVisitor();
results.Document.Accept(visitor);
return visitor.ModelTypeName;
}
public string ModelTypeName { get; private set; }
}
}

68
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpParser.cs

@ -1,68 +0,0 @@ @@ -1,68 +0,0 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using System.IO;
//using ICSharpCode.SharpDevelop;
//using ICSharpCode.SharpDevelop.Dom;
//using ICSharpCode.SharpDevelop.Dom.CSharp;
//using ICSharpCode.SharpDevelop.Project;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpParser : IParser
// {
// public RazorCSharpParser()
// {
// }
//
// public string[] LexerTags { get; set; }
//
// public LanguageProperties Language {
// get { return LanguageProperties.CSharp; }
// }
//
// public IExpressionFinder CreateExpressionFinder(string fileName)
// {
// return new RazorCSharpExpressionFinder();
// }
//
// public bool CanParse(string fileName)
// {
// return Path.GetExtension(fileName).Equals(".cshtml", StringComparison.OrdinalIgnoreCase);
// }
//
// public bool CanParse(IProject project)
// {
// return project.Language == "C#";
// }
//
// public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent)
// {
// var modelTypeLocater = new RazorCSharpModelTypeLocater(fileContent);
// return new RazorCompilationUnit(projectContent) {
// ModelTypeName = modelTypeLocater.ModelTypeName
// };
// }
//
// public IResolver CreateResolver()
// {
// return new RazorCSharpResolver();
// }
// }
//}

119
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpResolver.cs

@ -1,119 +0,0 @@ @@ -1,119 +0,0 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using System.Collections.Generic;
//using ICSharpCode.NRefactory.TypeSystem;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCSharpResolver : IResolver
// {
// NRefactoryResolver resolver = new NRefactoryResolver(LanguageProperties.CSharp);
//
// public ResolveResult Resolve(ExpressionResult expressionResult, ParseInformation parseInfo, string fileContent)
// {
// ParseInformation parseInfoWithWebViewPageClass = CreateParseInformationWithWebViewPageClass(parseInfo);
// expressionResult.Region = GetRegionInMiddleOfWebViewPageClass();
// return resolver.Resolve(expressionResult, parseInfoWithWebViewPageClass, fileContent);
// }
//
// ParseInformation CreateParseInformationWithWebViewPageClass(ParseInformation parseInfo)
// {
// RazorCompilationUnit compilationUnit = RazorCompilationUnit.CreateFromParseInfo(parseInfo);
// AddDefaultUsings(compilationUnit);
// AddWebViewPageClass(compilationUnit);
// return new ParseInformation(compilationUnit);
// }
//
// void AddDefaultUsings(ICompilationUnit compilationUnit)
// {
// AddUsing("System.Web.Mvc", compilationUnit);
// AddUsing("System.Web.Mvc.Ajax", compilationUnit);
// AddUsing("System.Web.Mvc.Html", compilationUnit);
// AddUsing("System.Web.Routing", compilationUnit);
// }
//
// void AddUsing(string name, ICompilationUnit compilationUnit)
// {
// DefaultUsing defaultUsing = CreateUsing(name, compilationUnit.ProjectContent);
// compilationUnit.UsingScope.Usings.Add(defaultUsing);
// }
//
// DefaultUsing CreateUsing(string namespaceName, IProjectContent projectContent)
// {
// var defaultUsing = new DefaultUsing(projectContent);
// defaultUsing.Usings.Add(namespaceName);
// return defaultUsing;
// }
//
// void AddWebViewPageClass(RazorCompilationUnit compilationUnit)
// {
// DefaultClass webViewPageClass = CreateWebViewPageClass(compilationUnit);
// compilationUnit.Classes.Add(webViewPageClass);
// }
//
// DefaultClass CreateWebViewPageClass(RazorCompilationUnit compilationUnit)
// {
// var webViewPageClass = new DefaultClass(compilationUnit, "RazorWebViewPage") {
// Region = new DomRegion(1, 0, 3, 0)
// };
// IReturnType modelType = GetModelReturnType(compilationUnit);
// AddWebViewPageBaseClass(webViewPageClass, modelType);
// return webViewPageClass;
// }
//
// IReturnType GetModelReturnType(RazorCompilationUnit compilationUnit)
// {
// IClass modelType = GetClassIfTypeNameIsNotEmpty(compilationUnit.ProjectContent, compilationUnit.ModelTypeName);
// if (modelType != null) {
// return modelType.DefaultReturnType;
// }
// return new DynamicReturnType(compilationUnit.ProjectContent);
// }
//
// IClass GetClassIfTypeNameIsNotEmpty(IProjectContent projectContent, string modelTypeName)
// {
// if (!String.IsNullOrEmpty(modelTypeName)) {
// return projectContent.GetClass(modelTypeName, 0);
// }
// return null;
// }
//
// void AddWebViewPageBaseClass(DefaultClass webViewPageClass, IReturnType modelType)
// {
// IClass webViewPageBaseClass = webViewPageClass.ProjectContent.GetClass("System.Web.Mvc.WebViewPage", 1);
// if (webViewPageBaseClass != null) {
// IReturnType returnType = GetWebViewPageBaseClassReturnType(webViewPageBaseClass, modelType);
// webViewPageClass.BaseTypes.Add(returnType);
// }
// }
//
// IReturnType GetWebViewPageBaseClassReturnType(IClass webViewPageBaseClass, IReturnType modelType)
// {
// var typeArguments = new List<IReturnType>();
// typeArguments.Add(modelType);
// return new ConstructedReturnType(webViewPageBaseClass.DefaultReturnType, typeArguments);
// }
//
// DomRegion GetRegionInMiddleOfWebViewPageClass()
// {
// return new DomRegion(2, 0, 2, 0);
// }
// }
//}

50
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCompilationUnit.cs

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//using System;
//using ICSharpCode.NRefactory.TypeSystem;
//using ICSharpCode.SharpDevelop.Parser;
//
//namespace ICSharpCode.AspNet.Mvc.Completion
//{
// public class RazorCompilationUnit : DefaultCompilationUnit
// {
// public RazorCompilationUnit(IProjectContent projectContent)
// : base(projectContent)
// {
// }
//
// public static RazorCompilationUnit CreateFromParseInfo(ParseInformation parseInformation)
// {
// return new RazorCompilationUnit(parseInformation.CompilationUnit.ProjectContent) {
// ModelTypeName = GetModelTypeName(parseInformation.CompilationUnit)
// };
// }
//
// static string GetModelTypeName(ICompilationUnit compilationUnit)
// {
// var originalRazorCompilationUnit = compilationUnit as RazorCompilationUnit;
// if (originalRazorCompilationUnit != null) {
// return originalRazorCompilationUnit.ModelTypeName;
// }
// return String.Empty;
// }
//
// public string ModelTypeName { get; set; }
// }
//}

29
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs

@ -55,35 +55,26 @@ namespace CSharpBinding @@ -55,35 +55,26 @@ namespace CSharpBinding
this.container.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), new Microsoft.CSharp.CSharpCodeProvider());
}
public override ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, FileName fileName, TextLocation location, ICodeContext context)
public override ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, ICodeContext context)
{
if (fileName == null)
throw new ArgumentNullException("fileName");
if (context == null)
throw new ArgumentNullException("context");
string content = GeneratePartialClassContextStub(fileName, location, context);
string content = GeneratePartialClassContextStub(context);
const string caretPoint = "$__Caret_Point__$;";
int caretOffset = content.IndexOf(caretPoint, StringComparison.Ordinal) + expressionToComplete.Length;
SD.Log.DebugFormatted("context used for dot completion: {0}", content.Replace(caretPoint, "$" + expressionToComplete + "|$"));
var doc = new ReadOnlyDocument(content.Replace(caretPoint, expressionToComplete));
return new CSharpCompletionBinding(fileName, doc.GetLocation(caretOffset), doc.CreateSnapshot());
return new CSharpCompletionBinding(context, doc.GetLocation(caretOffset), doc.CreateSnapshot());
}
static string GeneratePartialClassContextStub(FileName fileName, TextLocation location, ICodeContext context)
static string GeneratePartialClassContextStub(ICodeContext context)
{
var compilation = SD.ParserService.GetCompilationForFile(fileName);
var file = SD.ParserService.GetExistingUnresolvedFile(fileName);
if (compilation == null || file == null)
return "";
var unresolvedMember = file.GetMember(location);
if (unresolvedMember == null)
return "";
var member = unresolvedMember.Resolve(new SimpleTypeResolveContext(compilation.MainAssembly));
var member = context.CurrentMember;
if (member == null)
return "";
var builder = new TypeSystemAstBuilder();
MethodDeclaration decl;
if (unresolvedMember is IMethod) {
if (member is IMethod) {
// If it's a method, convert it directly (including parameters + type parameters)
decl = (MethodDeclaration)builder.ConvertEntity(member);
} else {
@ -97,11 +88,11 @@ namespace CSharpBinding @@ -97,11 +88,11 @@ namespace CSharpBinding
}
decl.Name = "__DebuggerStub__";
decl.ReturnType = builder.ConvertType(member.ReturnType);
decl.Modifiers = unresolvedMember.IsStatic ? Modifiers.Static : Modifiers.None;
decl.Modifiers = member.IsStatic ? Modifiers.Static : Modifiers.None;
// Make the method look like an explicit interface implementation so that it doesn't appear in CC
decl.PrivateImplementationType = new SimpleType("__DummyType__");
decl.Body = GenerateBodyFromContext(builder, context.LocalVariables.ToArray());
return WrapInType(unresolvedMember.DeclaringTypeDefinition, decl).ToString();
return WrapInType(context.CurrentTypeDefinition, decl).ToString();
}
static BlockStatement GenerateBodyFromContext(TypeSystemAstBuilder builder, IVariable[] variables)
@ -113,7 +104,7 @@ namespace CSharpBinding @@ -113,7 +104,7 @@ namespace CSharpBinding
return body;
}
static AstNode WrapInType(IUnresolvedTypeDefinition entity, EntityDeclaration decl)
static AstNode WrapInType(ITypeDefinition entity, EntityDeclaration decl)
{
if (entity == null)
return decl;
@ -137,7 +128,7 @@ namespace CSharpBinding @@ -137,7 +128,7 @@ namespace CSharpBinding
};
}
static ClassType GetClassType(IUnresolvedTypeDefinition entity)
static ClassType GetClassType(ITypeDefinition entity)
{
switch (entity.Kind) {
case TypeKind.Interface:

9
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs

@ -26,6 +26,7 @@ using ICSharpCode.NRefactory.CSharp.Resolver; @@ -26,6 +26,7 @@ using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.Completion;
using ICSharpCode.NRefactory.CSharp.Completion;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
@ -35,7 +36,7 @@ namespace CSharpBinding.Completion @@ -35,7 +36,7 @@ namespace CSharpBinding.Completion
{
public class CSharpCompletionBinding : ICodeCompletionBinding
{
FileName contextFileName;
ICodeContext context;
TextLocation currentLocation;
ITextSource fileContent;
@ -44,9 +45,9 @@ namespace CSharpBinding.Completion @@ -44,9 +45,9 @@ namespace CSharpBinding.Completion
{
}
public CSharpCompletionBinding(FileName contextFileName, TextLocation currentLocation, ITextSource fileContent)
public CSharpCompletionBinding(ICodeContext context, TextLocation currentLocation, ITextSource fileContent)
{
this.contextFileName = contextFileName;
this.context = context;
this.currentLocation = currentLocation;
this.fileContent = fileContent;
}
@ -75,7 +76,7 @@ namespace CSharpBinding.Completion @@ -75,7 +76,7 @@ namespace CSharpBinding.Completion
if (fileContent == null) {
completionContext = CSharpCompletionContext.Get(editor);
} else {
completionContext = CSharpCompletionContext.Get(editor, fileContent, currentLocation, contextFileName);
completionContext = CSharpCompletionContext.Get(editor, context, currentLocation, fileContent);
}
if (completionContext == null)
return false;

24
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs

@ -61,38 +61,24 @@ namespace CSharpBinding.Completion @@ -61,38 +61,24 @@ namespace CSharpBinding.Completion
return new CSharpCompletionContext(editor, parseInfo.SyntaxTree.ConditionalSymbols, compilation, projectContent, editor.Document, parseInfo.UnresolvedFile, editor.Caret.Location);
}
public static CSharpCompletionContext Get(ITextEditor editor, ITextSource fileContent, TextLocation currentLocation, FileName fileName)
public static CSharpCompletionContext Get(ITextEditor editor, ICodeContext context, TextLocation currentLocation, ITextSource fileContent)
{
IDocument document = new ReadOnlyDocument(fileContent);
// Don't require the very latest parse information, an older cached version is OK.
var parseInfo = SD.ParserService.GetCachedParseInformation(fileName) as CSharpFullParseInformation;
if (parseInfo == null) {
parseInfo = SD.ParserService.Parse(fileName) as CSharpFullParseInformation;
}
if (parseInfo == null)
return null;
var project = SD.ProjectService.FindProjectContainingFile(fileName)as CSharpProject;
if (project == null)
return null;
var solutionSnapshot = SD.ParserService.GetCurrentSolutionSnapshot();
var projectContent = solutionSnapshot.GetProjectContent(project);
var projectContent = context.Compilation.MainAssembly.UnresolvedAssembly as IProjectContent;
if (projectContent == null)
return null;
CSharpParser parser = new CSharpParser(project.CompilerSettings);
CSharpParser parser = new CSharpParser();
parser.GenerateTypeSystemMode = false;
SyntaxTree cu = parser.Parse(fileContent, Path.GetRandomFileName() + ".cs");
cu.Freeze();
CSharpUnresolvedFile unresolvedFile = cu.ToTypeSystem();
ICompilation compilation = projectContent.AddOrUpdateFiles(unresolvedFile).CreateCompilation(solutionSnapshot);
ICompilation compilation = projectContent.AddOrUpdateFiles(unresolvedFile).CreateCompilation(SD.ParserService.GetCurrentSolutionSnapshot());
return new CSharpCompletionContext(editor, parseInfo.SyntaxTree.ConditionalSymbols, compilation, projectContent, document, unresolvedFile, currentLocation);
return new CSharpCompletionContext(editor, EmptyList<string>.Instance, compilation, projectContent, document, unresolvedFile, currentLocation);
}
private CSharpCompletionContext(ITextEditor editor, IList<string> conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, CSharpUnresolvedFile unresolvedFile, TextLocation caretLocation)

44
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
using System;
using System.Linq;
using System.Threading;
using System.Windows.Controls;
using ICSharpCode.SharpDevelop;
using CSharpBinding.Parser;
using CSharpBinding.Refactoring;
@ -35,46 +36,27 @@ namespace CSharpBinding.Completion @@ -35,46 +36,27 @@ namespace CSharpBinding.Completion
/// </summary>
class EventCreationCompletionData : CompletionData
{
IEvent eventDefinition;
string varName;
IType delegateType;
string parameterList;
IUnresolvedMember callingMember;
IUnresolvedTypeDefinition declaringType;
CSharpResolver contextAtCaret;
readonly string handlerName;
readonly ITypeReference delegateTypeReference;
readonly bool isStatic;
public EventCreationCompletionData(string varName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret)
public EventCreationCompletionData(string handlerName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret)
{
if (string.IsNullOrEmpty(varName)) {
this.DisplayText = "<Create handler for " + (evt != null ? evt.Name : "") + ">";
if (string.IsNullOrEmpty(handlerName)) {
handlerName = (evt != null ? evt.Name : "Handle");
}
else {
this.DisplayText = "Handle" + char.ToUpper(varName[0]) + varName.Substring(1) + (evt != null ? evt.Name : "");
}
this.varName = varName;
this.eventDefinition = evt;
this.delegateType = delegateType;
this.parameterList = parameterList;
this.callingMember = callingMember;
this.declaringType = declaringType;
this.contextAtCaret = contextAtCaret;
this.handlerName = handlerName;
this.DisplayText = "<Create " + handlerName + ">";
this.delegateTypeReference = delegateType.ToTypeReference();
this.isStatic = callingMember != null && callingMember.IsStatic;
}
public override void Complete(CompletionContext context)
{
var invokeSignature = delegateType.GetMethods(m => m.Name == "Invoke").Single();
var refactoringContext = SDRefactoringContext.Create(context.Editor, CancellationToken.None);
var delegateType = delegateTypeReference.Resolve(refactoringContext.Compilation);
var invokeSignature = delegateType.GetMethods(m => m.Name == "Invoke").Single();
var builder = refactoringContext.CreateTypeSystemAstBuilder();
string handlerName;
bool isStatic;
if (eventDefinition != null) {
handlerName = eventDefinition.Name;
isStatic = eventDefinition.IsStatic;
} else {
handlerName = varName;
isStatic = callingMember.IsStatic;
}
var throwStatement = new ThrowStatement();
var decl = new MethodDeclaration {

2
src/AddIns/Debugger/Debugger.AddIn/Pads/AutoCompleteTextBox.cs

@ -134,7 +134,7 @@ namespace Debugger.AddIn.Pads.Controls @@ -134,7 +134,7 @@ namespace Debugger.AddIn.Pads.Controls
ContextTextLocation = new TextLocation(frame.NextStatement.StartLine, frame.NextStatement.StartColumn);
}
if (ContextFileName == null) return;
var binding = DebuggerDotCompletion.PrepareDotCompletion(editor.Text.Substring(0, editor.CaretOffset), ContextFileName, ContextTextLocation, SD.ParserService.ResolveContext(ContextFileName, ContextTextLocation));
var binding = DebuggerDotCompletion.PrepareDotCompletion(editor.Text.Substring(0, editor.CaretOffset), SD.ParserService.ResolveContext(ContextFileName, ContextTextLocation));
if (binding == null) return;
binding.HandleKeyPressed(editorAdapter, '.');
} else {

4
src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs

@ -150,7 +150,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -150,7 +150,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
bool showExternalMethods = DebuggingOptions.Instance.ShowExternalMethods;
var symSource = WindowsDebugger.PdbSymbolSource;
bool hasSymbols = symSource.Handles(frame.MethodInfo) && !symSource.IsCompilerGenerated(frame.MethodInfo);
bool hasSymbols = symSource.Handles(frame.MethodInfo)
&& !symSource.IsCompilerGenerated(frame.MethodInfo)
&& frame.NextStatement != null && !string.IsNullOrWhiteSpace(frame.NextStatement.Filename);
if (showExternalMethods || hasSymbols) {
// Show the method in the list
previousItemIsExternalMethod = false;

2
src/AddIns/Debugger/Debugger.AddIn/Pads/ConsolePad.cs

@ -88,7 +88,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -88,7 +88,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
var fileName = new ICSharpCode.Core.FileName(frame.NextStatement.Filename);
var textLocation = new TextLocation(frame.NextStatement.StartLine, frame.NextStatement.StartColumn);
var binding = DebuggerDotCompletion.PrepareDotCompletion(currentText, fileName, textLocation, SD.ParserService.ResolveContext(fileName, textLocation));
var binding = DebuggerDotCompletion.PrepareDotCompletion(currentText, SD.ParserService.ResolveContext(fileName, textLocation));
if (binding == null) return;
binding.HandleKeyPressed(console.TextEditor, '.');
}

8
src/AddIns/Debugger/Debugger.AddIn/Pads/DebuggerDotCompletion.cs

@ -41,12 +41,10 @@ namespace Debugger.AddIn.Pads.Controls @@ -41,12 +41,10 @@ namespace Debugger.AddIn.Pads.Controls
return !errors.Any();
}
public static ICodeCompletionBinding PrepareDotCompletion(string expressionToComplete, FileName fileName, TextLocation location, ICodeContext context)
public static ICodeCompletionBinding PrepareDotCompletion(string expressionToComplete, ICodeContext context)
{
var lang = SD.LanguageService.GetLanguageByFileName(fileName);
if (lang == null)
return null;
return lang.CreateCompletionBinding(expressionToComplete, fileName, location, context);
return SD.LanguageService.GetLanguageByExtension(".cs")
.CreateCompletionBinding(expressionToComplete, context);
}
}
}

2
src/AddIns/Debugger/Debugger.Core/Breakpoint.cs

@ -84,7 +84,7 @@ namespace Debugger @@ -84,7 +84,7 @@ namespace Debugger
public void SetBreakpoint(Module module)
{
foreach(var symbolSource in module.Process.Debugger.SymbolSources) {
foreach (var symbolSource in module.Process.Debugger.SymbolSources) {
foreach (var seq in symbolSource.GetSequencePoints(module, this.FileName, this.Line, this.Column)) {
ICorDebugFunction corFunction = module.CorModule.GetFunctionFromToken(seq.MethodDefToken);
ICorDebugFunctionBreakpoint corBreakpoint = corFunction.GetILCode().CreateBreakpoint((uint)seq.ILOffset);

39
src/AddIns/Debugger/Debugger.Core/PdbSymbolSource.cs

@ -48,6 +48,14 @@ namespace Debugger @@ -48,6 +48,14 @@ namespace Debugger
this.StartLine, this.StartColumn,
this.EndLine, this.EndColumn);
}
public bool ContainsLocation(int line, int column = 0)
{
if (column == 0)
return line >= StartLine && line <= EndLine;
return (StartLine < line || (StartLine == line && StartColumn <= column))
&& (line < EndLine || (line == EndLine && column <= EndColumn));
}
}
public struct ILRange
@ -185,14 +193,14 @@ namespace Debugger @@ -185,14 +193,14 @@ namespace Debugger
var realSeqPoints = sequencePoints.Where(p => p.StartLine != 0xFEEFEE);
// Find point for which (ilstart <= iloffset < ilend) or fallback to the next valid sequence point
var sequencePoint = realSeqPoints.FirstOrDefault(p => p.ILRanges.Any(r => r.From <= iloffset && iloffset < r.To)) ??
realSeqPoints.FirstOrDefault(p => iloffset <= p.ILOffset);
var sequencePoint = realSeqPoints.FirstOrDefault(p => p.ILRanges.Any(r => r.From <= iloffset && iloffset < r.To))
?? realSeqPoints.FirstOrDefault(p => iloffset <= p.ILOffset);
if (sequencePoint != null) {
// VB.NET sometimes produces temporary files which it then deletes
// (eg 17d14f5c-a337-4978-8281-53493378c1071.vb)
string name = Path.GetFileName(sequencePoint.Filename);
if (name.Length == 40 && name.EndsWith(".vb")) {
if (name.Length == 40 && name.EndsWith(".vb", StringComparison.OrdinalIgnoreCase)) {
if (name.Substring(0, name.Length - 3).All(c => ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') || (c == '-'))) {
return null;
}
@ -226,25 +234,34 @@ namespace Debugger @@ -226,25 +234,34 @@ namespace Debugger
try {
uint validLine = symDoc.FindClosestLine((uint)line);
symMethods = symReader.GetMethodsFromDocumentPosition(symDoc, validLine, (uint)column);
if (validLine > 0)
line = (int)validLine;
} catch {
yield break; //Not found
}
foreach (ISymUnmanagedMethod symMethod in symMethods) {
var corFunction = module.CorModule.GetFunctionFromToken(symMethod.GetToken());
int codesize = (int)corFunction.GetILCode().GetSize();
var seqPoints = symMethod.GetSequencePoints(codesize).Where(s => s.StartLine != 0xFEEFEE);
SequencePoint seqPoint = null;
if (column != 0) {
seqPoint = seqPoints.FirstOrDefault(s => (s.StartLine < line || (s.StartLine == line && s.StartColumn <= column)) &&
(line < s.EndLine || (line == s.EndLine && column <= s.EndColumn)));
}
seqPoint = seqPoint ?? seqPoints.FirstOrDefault(s => line <= s.StartLine);
int codeSize = (int)corFunction.GetILCode().GetSize();
var seqPoints = symMethod.GetSequencePoints(codeSize).Where(s => s.StartLine != 0xFEEFEE).OrderBy(s => s.StartLine).ToArray();
SequencePoint seqPoint = FindNearestMatchingSequencePoint(seqPoints, line, column);
if (seqPoint != null)
yield return seqPoint;
}
}
SequencePoint FindNearestMatchingSequencePoint(SequencePoint[] seqPoints, int line, int column)
{
for (int i = 0; i < seqPoints.Length; i++) {
var s = seqPoints[i];
if (s.ContainsLocation(line, column))
return s;
if (s.StartLine > line)
return s;
}
return null;
}
public IEnumerable<ILRange> GetIgnoredILRanges(IMethod method)
{
var symMethod = method.GetSymMethod();

4
src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs

@ -232,7 +232,9 @@ namespace Debugger @@ -232,7 +232,9 @@ namespace Debugger
{
var info = GetInfo(method.ParentAssembly);
var variableTypes = info.GetLocalVariableTypes(method.UnresolvedMember);
return variableTypes[index].Resolve(new SimpleTypeResolveContext(method));
return variableTypes[index]
.Resolve(new SimpleTypeResolveContext(method))
.AcceptVisitor(method.Substitution);
}
#endregion

59
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerToolTipProvider.cs

@ -67,64 +67,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -67,64 +67,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
string GetTooltipTextForCollapsedSection(ToolTipRequestEventArgs args, FoldingSection foldingSection)
{
// This fixes SD-1394:
// Each line is checked for leading indentation whitespaces. If
// a line has the same or more indentation than the first line,
// it is reduced. If a line is less indented than the first line
// the indentation is removed completely.
//
// See the following example:
// line 1
// line 2
// line 3
// line 4
//
// is reduced to:
// line 1
// line 2
// line 3
// line 4
const int maxLineCount = 15;
TextDocument document = (TextDocument)args.Editor.Document;
int startOffset = foldingSection.StartOffset;
int endOffset = foldingSection.EndOffset;
DocumentLine startLine = document.GetLineByOffset(startOffset);
DocumentLine endLine = document.GetLineByOffset(endOffset);
StringBuilder builder = new StringBuilder();
DocumentLine current = startLine;
ISegment startIndent = TextUtilities.GetLeadingWhitespace(document, startLine);
int lineCount = 0;
while (current != endLine.NextLine && lineCount < maxLineCount) {
ISegment currentIndent = TextUtilities.GetLeadingWhitespace(document, current);
if (current == startLine && current == endLine)
builder.Append(document.GetText(startOffset, endOffset - startOffset));
else if (current == startLine) {
if (current.EndOffset - startOffset > 0)
builder.AppendLine(document.GetText(startOffset, current.EndOffset - startOffset).TrimStart());
} else if (current == endLine) {
if (startIndent.Length <= currentIndent.Length)
builder.Append(document.GetText(current.Offset + startIndent.Length, endOffset - current.Offset - startIndent.Length));
else
builder.Append(document.GetText(current.Offset + currentIndent.Length, endOffset - current.Offset - currentIndent.Length));
} else {
if (startIndent.Length <= currentIndent.Length)
builder.AppendLine(document.GetText(current.Offset + startIndent.Length, current.Length - startIndent.Length));
else
builder.AppendLine(document.GetText(current.Offset + currentIndent.Length, current.Length - currentIndent.Length));
}
current = current.NextLine;
lineCount++;
}
if (current != endLine.NextLine)
builder.Append("...");
return builder.ToString();
return ToolTipUtils.GetAlignedText(args.Editor.Document, foldingSection.StartOffset, foldingSection.EndOffset);
}
}
}

20
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -50,6 +50,7 @@ namespace ICSharpCode.FormsDesigner @@ -50,6 +50,7 @@ namespace ICSharpCode.FormsDesigner
readonly Control pleaseWaitLabel = new Label() { Text = StringParser.Parse("${res:Global.PleaseWait}"), TextAlign=ContentAlignment.MiddleCenter };
DesignSurface designSurface;
bool disposing;
Timer timer = new Timer { Interval = 200 };
readonly IViewContent primaryViewContent;
readonly IDesignerLoaderProvider loaderProvider;
@ -142,10 +143,11 @@ namespace ICSharpCode.FormsDesigner @@ -142,10 +143,11 @@ namespace ICSharpCode.FormsDesigner
this.IsActiveViewContentChanged += this.IsActiveViewContentChangedHandler;
timer.Tick += Timer_Tick;
FileService.FileRemoving += this.FileServiceFileRemoving;
SD.Debugger.DebugStarting += this.DebugStarting;
}
public FormsDesignerViewContent(IViewContent primaryViewContent, IDesignerLoaderProvider loaderProvider)
: this(primaryViewContent)
{
@ -168,6 +170,20 @@ namespace ICSharpCode.FormsDesigner @@ -168,6 +170,20 @@ namespace ICSharpCode.FormsDesigner
this.Files.Add(primaryViewContent.PrimaryFile);
}
void Timer_Tick(object sender, System.EventArgs e)
{
// The WinForms designer internally relies on Application.Idle for some actions, e.g. 'Show Code'
// This event does not get raised in a WPF application.
// While we do forward WPF's equivalent idle event to WinForms (see WorkbenchStartup.cs),
// it doesn't happen often enough -- in particular, it doesn't get raised while the mouse
// is over the WinForms design surface.
// This caused the bug: https://github.com/icsharpcode/SharpDevelop/issues/525
// As a workaround, we use a timer to raise the event while the designer is open.
// Note: this timer is implemented in the WinForms designer and not globally in SharpDevelop
// so that we don't wake up the CPU unnecessarily when the designer is not in use.
Application.RaiseIdle(e);
}
bool inMasterLoadOperation;
protected override void LoadInternal(OpenedFile file, System.IO.Stream stream)
@ -344,6 +360,7 @@ namespace ICSharpCode.FormsDesigner @@ -344,6 +360,7 @@ namespace ICSharpCode.FormsDesigner
UpdatePropertyPad();
hasUnmergedChanges = false;
timer.Start();
LoggingService.Info("Form Designer: END INITIALIZE");
}
@ -404,6 +421,7 @@ namespace ICSharpCode.FormsDesigner @@ -404,6 +421,7 @@ namespace ICSharpCode.FormsDesigner
{
LoggingService.Debug("FormsDesigner unloading, setting ActiveDesignSurface to null");
designSurfaceManager.ActiveDesignSurface = null;
timer.Stop();
bool savedIsDirty = (this.DesignerCodeFile == null) ? false : this.DesignerCodeFile.IsDirty;
this.UserContent = this.pleaseWaitLabel;

9
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/ToolboxProvider.cs

@ -136,6 +136,13 @@ namespace ICSharpCode.FormsDesigner @@ -136,6 +136,13 @@ namespace ICSharpCode.FormsDesigner
toolboxService.SetSelectedToolboxItem(null);
}
static ICompilation GetCompilationForCurrentProject()
{
IProject project = SD.ProjectService.CurrentProject;
if (project == null) return null;
return SD.ParserService.GetCompilation(project);
}
static void SelectedToolUsedHandler(object sender, EventArgs e)
{
SD.Log.Debug("SelectedToolUsedHandler");
@ -148,7 +155,7 @@ namespace ICSharpCode.FormsDesigner @@ -148,7 +155,7 @@ namespace ICSharpCode.FormsDesigner
if (selectedItem != null && selectedItem.TypeName != null) {
SD.Log.Debug("Checking for reference to CustomComponent: " + selectedItem.TypeName);
// Check current project has the custom component first.
ICompilation currentCompilation = SD.ParserService.GetCompilationForCurrentProject();
ICompilation currentCompilation = GetCompilationForCurrentProject();
var typeName = new FullTypeName(selectedItem.TypeName);
if (currentCompilation != null && currentCompilation.FindType(typeName).Kind == TypeKind.Unknown) {
// Check other projects in the solution.

4
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditContainer.cs

@ -34,10 +34,6 @@ namespace HexEditor.View @@ -34,10 +34,6 @@ namespace HexEditor.View
get { return hexEditControl.HasSomethingSelected; }
}
public bool EditorFocused {
get { return hexEditControl.Focused; }
}
public bool CanUndo {
get { return hexEditControl.CanUndo; }
}

25
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditView.cs

@ -18,10 +18,8 @@ @@ -18,10 +18,8 @@
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using System.Windows.Input;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.WinForms;
using ICSharpCode.SharpDevelop.Workbench;
@ -34,7 +32,8 @@ namespace HexEditor.View @@ -34,7 +32,8 @@ namespace HexEditor.View
public HexEditView(OpenedFile file)
{
hexEditContainer = new HexEditContainer();
hexEditContainer.hexEditControl.DocumentChanged += new EventHandler(DocumentChanged);
hexEditContainer.hexEditControl.DocumentChanged += DocumentChanged;
hexEditContainer.hexEditControl.Selection.SelectionChanged += SelectionChanged;
this.Files.Add(file);
@ -67,23 +66,23 @@ namespace HexEditor.View @@ -67,23 +66,23 @@ namespace HexEditor.View
#region IClipboardHandler
public bool EnableCut {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
get { return hexEditContainer.HasSomethingSelected; }
}
public bool EnableCopy {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
get { return hexEditContainer.HasSomethingSelected; }
}
public bool EnablePaste {
get { return hexEditContainer.EditorFocused; }
get { return true; }
}
public bool EnableDelete {
get { return hexEditContainer.HasSomethingSelected & hexEditContainer.EditorFocused; }
get { return hexEditContainer.HasSomethingSelected; }
}
public bool EnableSelectAll {
get { return hexEditContainer.EditorFocused; }
get { return true; }
}
public void Cut()
@ -137,10 +136,12 @@ namespace HexEditor.View @@ -137,10 +136,12 @@ namespace HexEditor.View
void DocumentChanged(object sender, EventArgs e)
{
if (PrimaryFile != null) PrimaryFile.MakeDirty();
CommandManager.InvalidateRequerySuggested();
}
public override bool IsDirty {
get { return base.IsDirty; }
void SelectionChanged(object sender, System.EventArgs e)
{
CommandManager.InvalidateRequerySuggested();
}
}
}

2
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpyAddIn
return symbols.LocalVariables.Where(v => v.OriginalVariable != null).Select(
v => new Debugger.ILLocalVariable() {
Index = v.OriginalVariable.Index,
Type = loader.ReadTypeReference(v.Type).Resolve(context),
Type = loader.ReadTypeReference(v.Type).Resolve(context).AcceptVisitor(method.Substitution),
Name = v.Name,
IsCompilerGenerated = false,
ILRanges = new [] { new ILRange(0, int.MaxValue) }

23
src/AddIns/VersionControl/GitAddIn/Src/Git.cs

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
@ -59,7 +60,7 @@ namespace ICSharpCode.GitAddIn @@ -59,7 +60,7 @@ namespace ICSharpCode.GitAddIn
string wcRoot = FindWorkingCopyRoot(fileName);
if (wcRoot == null)
return Task.FromResult(false);
return RunGitAsync(wcRoot, "add", AdaptFileName(wcRoot, fileName));
return RunGitAsync(wcRoot, "add", "--intent-to-add", AdaptFileName(wcRoot, fileName));
}
public static Task RemoveAsync(string fileName, bool indexOnly)
@ -79,14 +80,24 @@ namespace ICSharpCode.GitAddIn @@ -79,14 +80,24 @@ namespace ICSharpCode.GitAddIn
return relFileName.Replace('\\', '/');
}
public static Task<int> RunGitAsync(string workingDir, params string[] arguments)
static SemaphoreSlim gitMutex = new SemaphoreSlim(1);
public static async Task<int> RunGitAsync(string workingDir, params string[] arguments)
{
string git = FindGit();
if (git == null)
return Task.FromResult(9009);
ProcessRunner p = new ProcessRunner();
p.WorkingDirectory = workingDir;
return p.RunInOutputPadAsync(GitMessageView.Category, git, arguments);
return 9009;
// Wait until other git calls have finished running
// This prevents git from failing due to a locked index when several files
// are added concurrently
await gitMutex.WaitAsync();
try {
ProcessRunner p = new ProcessRunner();
p.WorkingDirectory = workingDir;
return await p.RunInOutputPadAsync(GitMessageView.Category, git, arguments);
} finally {
gitMutex.Release();
}
}
/// <summary>

1
src/Main/Base/Project/Editor/DocumentationUIBuilder.cs

@ -453,6 +453,7 @@ namespace ICSharpCode.SharpDevelop.Editor @@ -453,6 +453,7 @@ namespace ICSharpCode.SharpDevelop.Editor
AddBlock(para);
}
inlineCollection.Add(inline);
ignoreWhitespace = false;
}
public void AddBlock(Block block)

86
src/Main/Base/Project/Editor/ToolTipUtils.cs

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Text;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.NRefactory.Editor;
namespace ICSharpCode.SharpDevelop.Editor
{
public static class ToolTipUtils
{
public static string GetAlignedText(IDocument document, int startOffset, int endOffset, int maxLineCount = 15)
{
// This fixes SD-1394:
// Each line is checked for leading indentation whitespaces. If
// a line has the same or more indentation than the first line,
// it is reduced. If a line is less indented than the first line
// the indentation is removed completely.
//
// See the following example:
// line 1
// line 2
// line 3
// line 4
//
// is reduced to:
// line 1
// line 2
// line 3
// line 4
if (maxLineCount < 1)
maxLineCount = int.MaxValue;
IDocumentLine startLine = document.GetLineByOffset(startOffset);
IDocumentLine endLine = document.GetLineByOffset(endOffset);
StringBuilder builder = new StringBuilder();
IDocumentLine current = startLine;
ISegment startIndent = TextUtilities.GetWhitespaceAfter(document, startLine.Offset);
int lineCount = 0;
while (current != endLine.NextLine && lineCount < maxLineCount) {
ISegment currentIndent = TextUtilities.GetWhitespaceAfter(document, current.Offset);
if (current == startLine && current == endLine)
builder.Append(document.GetText(startOffset, endOffset - startOffset));
else if (current == startLine) {
if (current.EndOffset - startOffset > 0)
builder.AppendLine(document.GetText(startOffset, current.EndOffset - startOffset).TrimStart());
} else if (current == endLine) {
if (startIndent.Length <= currentIndent.Length)
builder.Append(document.GetText(current.Offset + startIndent.Length, endOffset - current.Offset - startIndent.Length));
else
builder.Append(document.GetText(current.Offset + currentIndent.Length, endOffset - current.Offset - currentIndent.Length));
} else {
if (startIndent.Length <= currentIndent.Length)
builder.AppendLine(document.GetText(current.Offset + startIndent.Length, current.Length - startIndent.Length));
else
builder.AppendLine(document.GetText(current.Offset + currentIndent.Length, current.Length - currentIndent.Length));
}
current = current.NextLine;
lineCount++;
}
if (current != endLine.NextLine)
builder.Append("...");
return builder.ToString();
}
}
}

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -171,6 +171,7 @@ @@ -171,6 +171,7 @@
<DependentUpon>ToolTipService.cs</DependentUpon>
</Compile>
<Compile Include="Editor\ToolTipService.cs" />
<Compile Include="Editor\ToolTipUtils.cs" />
<Compile Include="Editor\XmlDocFormatter.cs" />
<Compile Include="Parser\CombinedAssemblySearcher.cs" />
<Compile Include="Parser\DefaultAssemblySearcher.cs" />

2
src/Main/Base/Project/Src/Services/LanguageBinding/DefaultLanguageBinding.cs

@ -75,7 +75,7 @@ namespace ICSharpCode.SharpDevelop @@ -75,7 +75,7 @@ namespace ICSharpCode.SharpDevelop
}
}
public virtual ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, FileName fileName, TextLocation location, ICodeContext context)
public virtual ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, ICodeContext context)
{
throw new NotSupportedException();
}

2
src/Main/Base/Project/Src/Services/LanguageBinding/ILanguageBinding.cs

@ -65,6 +65,6 @@ namespace ICSharpCode.SharpDevelop @@ -65,6 +65,6 @@ namespace ICSharpCode.SharpDevelop
/// <summary>
/// Creates a completion binding for a given expression and context.
/// </summary>
ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, FileName fileName, TextLocation location, ICodeContext context);
ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, ICodeContext context);
}
}

1
src/Main/Base/Project/Templates/ProjectTemplate.cs

@ -70,6 +70,7 @@ namespace ICSharpCode.SharpDevelop.Templates @@ -70,6 +70,7 @@ namespace ICSharpCode.SharpDevelop.Templates
if (SD.ProjectService.OpenSolution(createdSolution)) {
solutionOpened = true;
SD.GetRequiredService<IProjectServiceRaiseEvents>().RaiseSolutionCreated(new SolutionEventArgs(createdSolution));
FileService.FireFileCreated(solutionFileName, false);
return result;
} else {
return null;

11
src/Main/Base/Project/Util/SharpDevelopExtensions.cs

@ -902,17 +902,6 @@ namespace ICSharpCode.SharpDevelop @@ -902,17 +902,6 @@ namespace ICSharpCode.SharpDevelop
}
#endregion
#region Service Extensions
public static ICompilation GetCompilationForCurrentProject(this IParserService svc)
{
if (svc == null)
throw new ArgumentNullException("svc");
IProject project = SD.ProjectService.CurrentProject;
if (project == null) return null;
return SD.ParserService.GetCompilation(project);
}
#endregion
#region Resource Service Extensions
/// <summary>
/// Gets an <see cref="IImage"/> from a resource.

11
src/Main/Core/Project/Src/Util/CommandWrapper.cs

@ -44,6 +44,17 @@ namespace ICSharpCode.Core @@ -44,6 +44,17 @@ namespace ICSharpCode.Core
/// </summary>
public static ICommand CreateLazyCommand(Codon codon, IReadOnlyCollection<ICondition> conditions)
{
if (codon.Properties["loadclasslazy"] == "false") {
// if lazy loading was explicitly disabled, create the actual command now
return CreateCommand(codon, conditions);
}
if (codon.Properties.Contains("command") && !codon.Properties.Contains("loadclasslazy")) {
// If we're using the 'command=' syntax, this is most likely a built-in command
// where lazy loading isn't useful (and hurts if CanExecute is used).
// Don't use lazy loading unless loadclasslazy is set explicitly.
return CreateCommand(codon, conditions);
}
// Create the wrapper that lazily loads the actual command.
return new CommandWrapper(codon, conditions);
}

7
src/Main/ICSharpCode.Core.Presentation/Menu/MenuCommand.cs

@ -32,13 +32,10 @@ namespace ICSharpCode.Core.Presentation @@ -32,13 +32,10 @@ namespace ICSharpCode.Core.Presentation
{
readonly string ActivationMethod;
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand, string activationMethod, IReadOnlyCollection<ICondition> conditions) : base(codon, caller, conditions)
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, string activationMethod, IReadOnlyCollection<ICondition> conditions) : base(codon, caller, conditions)
{
this.ActivationMethod = activationMethod;
if (createCommand)
this.Command = CommandWrapper.CreateCommand(codon, conditions);
else
this.Command = CommandWrapper.CreateLazyCommand(codon, conditions);
this.Command = CommandWrapper.CreateLazyCommand(codon, conditions);
this.CommandParameter = caller;
if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) {

3
src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs

@ -211,7 +211,6 @@ namespace ICSharpCode.Core.Presentation @@ -211,7 +211,6 @@ namespace ICSharpCode.Core.Presentation
{
Codon codon = descriptor.Codon;
string type = codon.Properties.Contains("type") ? codon.Properties["type"] : "Command";
bool createCommand = codon.Properties["loadclasslazy"] == "false";
switch (type) {
case "Separator":
@ -220,7 +219,7 @@ namespace ICSharpCode.Core.Presentation @@ -220,7 +219,7 @@ namespace ICSharpCode.Core.Presentation
return new MenuCheckBox(context.InputBindingOwner, codon, descriptor.Parameter, descriptor.Conditions);
case "Item":
case "Command":
return new MenuCommand(context.InputBindingOwner, codon, descriptor.Parameter, createCommand, context.ActivationMethod, descriptor.Conditions);
return new MenuCommand(context.InputBindingOwner, codon, descriptor.Parameter, context.ActivationMethod, descriptor.Conditions);
case "Menu":
var item = new CoreMenuItem(codon, descriptor.Parameter, descriptor.Conditions) {
ItemsSource = new object[1],

7
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarButton.cs

@ -36,16 +36,13 @@ namespace ICSharpCode.Core.Presentation @@ -36,16 +36,13 @@ namespace ICSharpCode.Core.Presentation
readonly string inputGestureText;
readonly IEnumerable<ICondition> conditions;
public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand, IReadOnlyCollection<ICondition> conditions)
public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, IReadOnlyCollection<ICondition> conditions)
{
ToolTipService.SetShowOnDisabled(this, true);
this.codon = codon;
this.caller = caller;
if (createCommand)
this.Command = CommandWrapper.CreateCommand(codon, conditions);
else
this.Command = CommandWrapper.CreateLazyCommand(codon, conditions);
this.Command = CommandWrapper.CreateLazyCommand(codon, conditions);
this.CommandParameter = caller;
this.Content = ToolBarService.CreateToolBarItemContent(codon);
this.conditions = conditions;

4
src/Main/ICSharpCode.Core.Presentation/ToolBar/ToolBarService.cs

@ -65,15 +65,13 @@ namespace ICSharpCode.Core.Presentation @@ -65,15 +65,13 @@ namespace ICSharpCode.Core.Presentation
object caller = descriptor.Parameter;
string type = codon.Properties.Contains("type") ? codon.Properties["type"] : "Item";
bool createCommand = codon.Properties["loadclasslazy"] == "false";
switch (type) {
case "Separator":
return new ConditionalSeparator(codon, caller, true, descriptor.Conditions);
case "CheckBox":
return new ToolBarCheckBox(codon, caller, descriptor.Conditions);
case "Item":
return new ToolBarButton(inputBindingOwner, codon, caller, createCommand, descriptor.Conditions);
return new ToolBarButton(inputBindingOwner, codon, caller, descriptor.Conditions);
case "DropDownButton":
return new ToolBarDropDownButton(
codon, caller, MenuService.CreateUnexpandedMenuItems(

12
src/Main/ICSharpCode.Core.WinForms/Menu/MenuCommand.cs

@ -43,23 +43,13 @@ namespace ICSharpCode.Core.WinForms @@ -43,23 +43,13 @@ namespace ICSharpCode.Core.WinForms
}
public MenuCommand(Codon codon, object caller, IReadOnlyCollection<ICondition> conditions)
: this(codon, caller, false, conditions)
{
}
public MenuCommand(Codon codon, object caller, bool createCommand, IReadOnlyCollection<ICondition> conditions)
{
this.RightToLeft = RightToLeft.Inherit;
this.caller = caller;
this.codon = codon;
this.conditions = conditions;
if (createCommand) {
this.command = CommandWrapper.CreateCommand(codon, conditions);
} else {
this.command = CommandWrapper.CreateLazyCommand(codon, conditions);
}
this.command = CommandWrapper.CreateLazyCommand(codon, conditions);
UpdateText();
}

2
src/Main/ICSharpCode.Core.WinForms/Menu/MenuService.cs

@ -62,7 +62,7 @@ namespace ICSharpCode.Core.WinForms @@ -62,7 +62,7 @@ namespace ICSharpCode.Core.WinForms
return new MenuCheckBox(codon, descriptor.Parameter, descriptor.Conditions);
case "Item":
case "Command":
return new MenuCommand(codon, descriptor.Parameter, createCommand, descriptor.Conditions);
return new MenuCommand(codon, descriptor.Parameter, descriptor.Conditions);
case "Menu":
return new Menu(codon, descriptor.Parameter, ConvertSubItems(descriptor.SubItems), descriptor.Conditions);
case "Builder":

1
src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngine.cs

@ -94,6 +94,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -94,6 +94,7 @@ namespace ICSharpCode.SharpDevelop.Project
throw new ArgumentNullException("feedbackSink");
var additionalTargetFileList = additionalTargetFiles != null ? additionalTargetFiles.ToList() : new List<string>();
additionalTargetFileList.AddRange(AdditionalTargetFiles.Select(fileName => fileName.ToString()));
if (project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
additionalTargetFileList.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets"));
}

2
src/Main/SharpDevelop/Templates/Project/ProjectDescriptor.cs

@ -514,6 +514,7 @@ namespace ICSharpCode.SharpDevelop.Templates @@ -514,6 +514,7 @@ namespace ICSharpCode.SharpDevelop.Templates
file.SetProjectItemProperties(projectFile);
project.Items.Add(projectFile);
FileService.FireFileCreated(fileName, false);
}
}
@ -535,6 +536,7 @@ namespace ICSharpCode.SharpDevelop.Templates @@ -535,6 +536,7 @@ namespace ICSharpCode.SharpDevelop.Templates
project.ProjectLoaded();
SD.GetRequiredService<IProjectServiceRaiseEvents>().RaiseProjectCreated(new ProjectEventArgs(project));
FileService.FireFileCreated(project.FileName, false);
templateResults.NewProjects.Add(project);
success = true;
return true;

Loading…
Cancel
Save