Browse Source

Applied CSharpOutputVisitor patch from Rodrigo B. de Oliveira.

Make go to work with partial classes.
Show expression in tooltips while pressing Ctrl.
Project templates can now specify the BuildAction and CopyToOutputDirectory properties for files.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@421 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
7c69708220
  1. 7
      data/options/SharpDevelop-tools.xml
  2. 19
      data/templates/file/CPPNet/CPP.Wizards.NewClass.xft
  3. 2
      data/templates/file/Misc/EmptyXmlUserControl.xft
  4. 4
      data/templates/project/CSharp/SharpDevelopAddin.xpt
  5. 3
      src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
  6. 23
      src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.dll.config
  7. 4
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Configuration/AssemblyInfo.cs
  8. 12
      src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs
  9. 2
      src/Main/Base/Project/Src/Dom/Implementations/CompoundClass.cs
  10. 3
      src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
  11. 29
      src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs
  12. 13
      src/Main/Base/Project/Src/Internal/Templates/File/FileTemplate.cs
  13. 16
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs
  14. 27
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  15. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs
  16. 2
      src/Main/Core/Project/ICSharpCode.Core.csproj
  17. 8
      src/SharpDevelop.WithTests.sln

7
data/options/SharpDevelop-tools.xml

@ -13,4 +13,11 @@ @@ -13,4 +13,11 @@
<MENUCOMMAND>IL Dasm</MENUCOMMAND>
<PROMPTFORARGUMENTS>False</PROMPTFORARGUMENTS>
</TOOL>
<TOOL>
<INITIALDIRECTORY>${TargetDir}</INITIALDIRECTORY>
<ARGUMENTS></ARGUMENTS>
<COMMAND>${NetSdkDir}bin\FUSLOGVW.exe</COMMAND>
<MENUCOMMAND>Assembly Binding Log Viewer</MENUCOMMAND>
<PROMPTFORARGUMENTS>False</PROMPTFORARGUMENTS>
</TOOL>
</TOOLS>

19
data/templates/file/CPPNet/CPP.Wizards.NewClass.xft

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
<?xml version="1.0"?>
<Template author="Roman Taranchenko" version="1.0">
<Config
name = "${res:Templates.File.NewClassWizard.Name}"
icon = "C++.File.NewClass"
category = "C++"
defaultname = "Class${Number}.cs"
language = "C++.NET">
<Wizard path = "/SharpDevelop/Templates/File/NewClassWizard"/>
</Config>
<Description>${res:Templates.File.NewClassWizard.Description}</Description>
<Files/>
<AdditionalOptions/>
</Template>

2
data/templates/file/Misc/EmptyXmlUserControl.xft

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
defaultname = "XmlUserControl${Number}.xfrm"
language = "XmlForm"/>
<Description>Creates an empty xml form.</Description>
<Description>Creates an empty xml user control.</Description>
<Files>
<File name="${FullName}" language="XmlForm"><![CDATA[<Components version="1.0">

4
data/templates/project/CSharp/SharpDevelopAddin.xpt

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
</ProjectItems>
<Files>
<File name="${ProjectName}.addin"><![CDATA[<AddIn name = "${ProjectName}"
<File name="${ProjectName}.addin" copyToOutputDirectory="Always"><![CDATA[<AddIn name = "${ProjectName}"
author = "${USER}"
copyright = "GNU General Public License"
url = ""
@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
</Path>
</AddIn>
]]></File>
<File name="Resources/MyUserControl.xfrm">
<File name="Resources/MyUserControl.xfrm" buildAction="EmbeddedResource">
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Components version="1.0">
<System.Windows.Forms.UserControl>

3
src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj

@ -96,6 +96,9 @@ @@ -96,6 +96,9 @@
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<Content Include="XmlEditor.Tests.dll.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

23
src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.dll.config

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.Core" publicKeyToken="f829da5c02be14ee" culture="neutral"/>
<codeBase version="2.0.0.1" href="../../../../bin/ICSharpCode.Core.dll"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpDevelop" publicKeyToken="f829da5c02be14ee" culture="neutral"/>
<codeBase version="2.0.0.1" href="../../../../bin/ICSharpCode.SharpDevelop.dll"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.TextEditor" publicKeyToken="4d61825e8dd49f1a" culture="neutral"/>
<codeBase version="2.0.0.1" href="../../../../bin/ICSharpCode.TextEditor.dll"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.NRefactory" publicKeyToken="efe927acf176eea2" culture="neutral"/>
<codeBase version="2.0.0.1" href="../../../../bin/ICSharpCode.NRefactory.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

4
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Configuration/AssemblyInfo.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <owner name="David Srbeck?" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>

12
src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs

@ -297,7 +297,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -297,7 +297,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
VisitAttributes(fieldDeclaration.Attributes, data);
outputFormatter.Indent();
outputFormatter.PrintIdentifier(f.Name);
if (f.Initializer != null) {
if (f.Initializer != null && !f.Initializer.IsNull) {
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Assign);
outputFormatter.Space();
@ -1597,7 +1597,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1597,7 +1597,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
return null;
}
outputFormatter.PrintIdentifier(primitiveExpression.Value.ToString());
if (primitiveExpression.Value is IFormattable) {
outputFormatter.PrintText(((IFormattable)primitiveExpression.Value).ToString(null, NumberFormatInfo.InvariantInfo));
} else {
outputFormatter.PrintIdentifier(primitiveExpression.Value.ToString());
}
return null;
}
@ -1934,8 +1939,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1934,8 +1939,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
break;
case AssignmentOperatorType.ShiftRight:
outputFormatter.PrintToken(Tokens.GreaterThan);
outputFormatter.PrintToken(Tokens.GreaterThan);
outputFormatter.PrintToken(Tokens.Equal);
outputFormatter.PrintToken(Tokens.GreaterEqual);
break;
case AssignmentOperatorType.ExclusiveOr:
outputFormatter.PrintToken(Tokens.XorAssign);

2
src/Main/Base/Project/Src/Dom/Implementations/CompoundClass.cs

@ -47,6 +47,8 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -47,6 +47,8 @@ namespace ICSharpCode.SharpDevelop.Dom
{
// Common for all parts:
this.ClassType = parts[0].ClassType;
this.CompilationUnit.FileName = parts[0].CompilationUnit.FileName;
this.Region = parts[0].Region;
ModifierEnum modifier = ModifierEnum.None;
this.BaseTypes.Clear();

3
src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs

@ -107,6 +107,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -107,6 +107,9 @@ namespace ICSharpCode.SharpDevelop.Dom
get {
return region;
}
set {
region = value;
}
}
public override string DotNetName {

29
src/Main/Base/Project/Src/Internal/Templates/File/FileDescriptionTemplate.cs

@ -18,6 +18,17 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -18,6 +18,17 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string name;
string language;
string content;
string buildAction;
string copyToOutputDirectory;
public FileDescriptionTemplate(XmlElement xml)
{
name = xml.GetAttribute("name");
language = xml.GetAttribute("language");
buildAction = xml.GetAttribute("buildAction");
copyToOutputDirectory = xml.GetAttribute("copyToOutputDirectory");
content = xml.InnerText;
}
public FileDescriptionTemplate(string name, string language, string content)
{
@ -37,11 +48,29 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -37,11 +48,29 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
return language;
}
}
public string Content {
get {
return content;
}
}
public string BuildAction {
get {
return buildAction ?? "";
}
set {
buildAction = value;
}
}
public string CopyToOutputDirectory {
get {
return copyToOutputDirectory ?? "";
}
set {
copyToOutputDirectory = value;
}
}
}
}

13
src/Main/Base/Project/Src/Internal/Templates/File/FileTemplate.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -73,7 +73,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
}
}
public class TemplateScript
public class TemplateScript
{
string languageName;
string runAt;
@ -291,10 +291,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -291,10 +291,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
XmlElement files = doc.DocumentElement["Files"];
XmlNodeList nodes = files.ChildNodes;
foreach (XmlElement filenode in nodes) {
FileDescriptionTemplate template = new FileDescriptionTemplate(filenode.GetAttribute("name"),
filenode.GetAttribute("language"),
filenode.InnerText);
this.files.Add(template);
this.files.Add(new FileDescriptionTemplate(filenode));
}
// load scripts (if any)
@ -312,9 +309,9 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -312,9 +309,9 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
static FileTemplate()
{
List<string> files = FileUtility.SearchDirectory(PropertyService.DataDirectory +
Path.DirectorySeparatorChar + "templates" +
Path.DirectorySeparatorChar + "file", "*.xft");
List<string> files = FileUtility.SearchDirectory(PropertyService.DataDirectory +
Path.DirectorySeparatorChar + "templates" +
Path.DirectorySeparatorChar + "file", "*.xft");
foreach (string file in files) {
try {
if (Path.GetExtension(file) == ".xft") {

16
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -130,8 +130,15 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -130,8 +130,15 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
string fileName = Path.Combine(projectCreateInformation.ProjectBasePath, StringParser.Parse(file.Name, new string[,] { {"ProjectName", projectCreateInformation.ProjectName} }));
FileProjectItem projectFile = new FileProjectItem(project, ItemType.Compile);
if (!project.CanCompile(fileName)) {
projectFile.BuildAction = FileProjectItem.FileBuildAction.None;
if (file.BuildAction.Length > 0) {
projectFile.BuildAction = (FileProjectItem.FileBuildAction)Enum.Parse(typeof(FileProjectItem.FileBuildAction), file.BuildAction);
} else {
if (!project.CanCompile(fileName)) {
projectFile.BuildAction = FileProjectItem.FileBuildAction.None;
}
}
if (file.CopyToOutputDirectory.Length > 0) {
projectFile.CopyToOutputDirectory = (CopyToOutputDirectory)Enum.Parse(typeof(CopyToOutputDirectory), file.CopyToOutputDirectory);
}
projectFile.Include = FileUtility.GetRelativePath(project.Directory, fileName);
@ -196,10 +203,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -196,10 +203,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
foreach (XmlNode node in element["Files"].ChildNodes) {
if (node != null && node.Name == "File") {
XmlElement filenode = (XmlElement)node;
FileDescriptionTemplate template = new FileDescriptionTemplate(filenode.GetAttribute("name"),
filenode.GetAttribute("language"),
filenode.InnerText);
projectDescriptor.files.Add(template);
projectDescriptor.files.Add(new FileDescriptionTemplate(filenode));
}
}
}

27
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -309,9 +309,7 @@ namespace ICSharpCode.Core @@ -309,9 +309,7 @@ namespace ICSharpCode.Core
mousepos.Y - viewRect.Top);
if (logicPos.Y >= 0 && logicPos.Y < textArea.Document.TotalNumberOfLines) {
// This is for testing olny - it must be reworked properly
if (Control.ModifierKeys == Keys.Control) {
if (currentDebugger == null) return;
if (!currentDebugger.IsDebugging) return;
if (Control.ModifierKeys == Keys.Control && currentDebugger != null && currentDebugger.IsDebugging) {
SetIPArgs a = new SetIPArgs();
a.filename = textArea.MotherTextEditorControl.FileName;
a.line = logicPos.Y;
@ -345,9 +343,9 @@ namespace ICSharpCode.Core @@ -345,9 +343,9 @@ namespace ICSharpCode.Core
ResolveResult result = ParserService.Resolve(expressionResult, logicPos.Y + 1, logicPos.X + 1, textArea.MotherTextEditorControl.FileName, textContent);
string value = GetText(result, expression);
if (value != null) {
#if DEBUG
value = "expr: >" + expression + "<\n" + value;
#endif
if (Control.ModifierKeys == Keys.Control) {
value = "expr: >" + expression + "<\n" + value;
}
textArea.SetToolTip(value);
}
oldToolTip = value;
@ -364,8 +362,10 @@ namespace ICSharpCode.Core @@ -364,8 +362,10 @@ namespace ICSharpCode.Core
static string GetText(ResolveResult result, string expression)
{
if (result == null)
return null;
if (result == null) {
// when pressing control, show the expression even when it could not be resolved
return (Control.ModifierKeys == Keys.Control) ? "" : null;
}
if (result is MixedResolveResult)
return GetText(((MixedResolveResult)result).PrimaryResult, expression);
IAmbience ambience = AmbienceService.CurrentAmbience;
@ -407,9 +407,14 @@ namespace ICSharpCode.Core @@ -407,9 +407,14 @@ namespace ICSharpCode.Core
else
return "Overload of " + ambience.Convert(mrr.ContainingType) + "." + mrr.Name;
} else {
// if (result.ResolvedType != null)
// return "expression of type " + ambience.Convert(result.ResolvedType);
return null;
if (Control.ModifierKeys == Keys.Control) {
if (result.ResolvedType != null)
return "expression of type " + ambience.Convert(result.ResolvedType);
else
return "ResolveResult without ResolvedType";
} else {
return null;
}
}
}

2
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -343,7 +343,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -343,7 +343,7 @@ namespace ICSharpCode.SharpDevelop.Gui
void GotoRegion(IRegion region, string fileName)
{
if (fileName != null) {
if (fileName != null && region != null) {
FileService.JumpToFilePosition(fileName, region.BeginLine - 1, region.BeginColumn - 1);
}
}

2
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -141,4 +141,4 @@ @@ -141,4 +141,4 @@
<Folder Include="Src\Services\LoggingService" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

8
src/SharpDevelop.WithTests.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.397
# SharpDevelop 2.0.0.413
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display @@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor.Tests", "AddIns\DisplayBindings\XmlEditor\Test\XmlEditor.Tests.csproj", "{FC0FE702-A87D-4D70-A9B6-1ECCD611125F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor", "AddIns\DisplayBindings\XmlEditor\Project\XmlEditor.csproj", "{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormDesigner", "AddIns\DisplayBindings\FormDesigner\Project\FormDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}"
@ -58,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{ @@ -58,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "Libraries\NUnit.Framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryTests", "Libraries\NRefactory\Test\NRefactoryTests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks", "Libraries\ICSharpCode.Build.Tasks\Project\ICSharpCode.Build.Tasks.csproj", "{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}"
@ -171,6 +175,7 @@ Global @@ -171,6 +175,7 @@ Global
{CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{6B717BD1-CD5E-498C-A42E-9E6A4584DC48} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{FC0FE702-A87D-4D70-A9B6-1ECCD611125F} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C}
{BF38FB72-B380-4196-AF8C-95749D726C61} = {FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C}
{6e59af58-f635-459a-9a35-c9ac41c00339} = {FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C}
@ -191,6 +196,7 @@ Global @@ -191,6 +196,7 @@ Global
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{870115DD-960A-4406-A6B9-600BCDC36A03} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{83DD7E12-A705-4DBA-9D71-09C8973D9382} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{2748AD25-9C63-4E12-877B-4DCE96FBED54} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}

Loading…
Cancel
Save