Skip to content

Commit

Permalink
moved code completion to the main CShell project, updated binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebuehler committed May 9, 2014
1 parent a22e2aa commit d75dcca
Show file tree
Hide file tree
Showing 65 changed files with 2,275 additions and 9,742 deletions.
Binary file removed Lib/ICSharpCode.AvalonEdit.dll
Binary file not shown.
9,641 changes: 0 additions & 9,641 deletions Lib/ICSharpCode.AvalonEdit.xml

This file was deleted.

Binary file removed Lib/ICSharpCode.CodeCompletion.dll
Binary file not shown.
51 changes: 0 additions & 51 deletions Lib/ICSharpCode.CodeCompletion.xml

This file was deleted.

Binary file removed Lib/Mono.CSharp.dll
Binary file not shown.
6 changes: 5 additions & 1 deletion Lib/README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Most packages are installed using NuGet (see main readme.md).

But AvalonEdit and NRefactory is installed from a custom build. The source code can be found here: https://github.com/lukebuehler/NRefactory-Completion-Sample
NRefactory is installed from the latest build from GitHub since they update NuGet too infrequently.
https://github.com/icsharpcode/NRefactory

The XhtmlDumper project can be found on GitHub as well.
https://github.com/lukebuehler/XhtmlDumper
4 changes: 2 additions & 2 deletions Scripts/Tutorial.csx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ x + x;

// The state is preserved now just enter "x" in the REPL and hit enter: The variable "x" containing the value 7 is still there.

// Methods can be declared too, but only in classes. Select the class and send it to the REPL:
// (It's commented out so as not to mess up the code completion, execute it without the comments)
// Methods can be declared too, but only in classes. Select the class and send it to the REPL.
// Select lines 35-45 and press Alt+Enter, to evaluate the class an make it available for later.
/*
static class MyMath
{
Expand Down
14 changes: 12 additions & 2 deletions Src/CShell.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Files", "Files", "{CE1B7BD1-A200-4887-8090-42C10D816D2F}"
ProjectSection(SolutionItems) = preProject
..\Doc\Links.txt = ..\Doc\Links.txt
Expand All @@ -19,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{4A604F
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CShell", "CShell\CShell.csproj", "{751E2557-C070-480D-A3B9-662CDFE03907}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CShellCore.CodeCompletion", "CShellCore.CodeCompletion\CShellCore.CodeCompletion.csproj", "{2ADF8E19-B896-4778-8391-BC55FB100852}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -41,6 +45,12 @@ Global
{751E2557-C070-480D-A3B9-662CDFE03907}.Release|Any CPU.Build.0 = Release|Any CPU
{751E2557-C070-480D-A3B9-662CDFE03907}.Release|x86.ActiveCfg = Release|x86
{751E2557-C070-480D-A3B9-662CDFE03907}.Release|x86.Build.0 = Release|x86
{2ADF8E19-B896-4778-8391-BC55FB100852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2ADF8E19-B896-4778-8391-BC55FB100852}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ADF8E19-B896-4778-8391-BC55FB100852}.Debug|x86.ActiveCfg = Debug|Any CPU
{2ADF8E19-B896-4778-8391-BC55FB100852}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ADF8E19-B896-4778-8391-BC55FB100852}.Release|Any CPU.Build.0 = Release|Any CPU
{2ADF8E19-B896-4778-8391-BC55FB100852}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions Src/CShell/AppBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ protected override void Configure()
{
//to start we just add the already loaded assemblies to the container & the assemblies in exe folder
var directoryCatalog = new DirectoryCatalog(@"./");

//use this code to look into loader exceptions, the code bellow is faster.
//try
//{
// // load the assembly or type
// foreach (var part in directoryCatalog.Parts)
// {
// var assembly = ReflectionModelServices.GetPartType(part).Value.Assembly;
// if (!AssemblySource.Instance.Contains(assembly))
// AssemblySource.Instance.Add(assembly);
// }
//}
//catch (Exception ex)
//{
// if (ex is System.Reflection.ReflectionTypeLoadException)
// {
// var typeLoadException = ex as ReflectionTypeLoadException;
// var loaderExceptions = typeLoadException.LoaderExceptions;
// }
//}

AssemblySource.Instance.AddRange(
directoryCatalog.Parts
.AsParallel()
Expand Down
29 changes: 18 additions & 11 deletions Src/CShell/CShell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Caliburn.Micro.1.5.2\lib\net40\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.AvalonEdit, Version=4.2.0.8783, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<Reference Include="ICSharpCode.AvalonEdit, Version=4.4.2.9744, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\ICSharpCode.AvalonEdit.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.CodeCompletion">
<HintPath>..\..\Lib\ICSharpCode.CodeCompletion.dll</HintPath>
<HintPath>..\..\Lib\AvalonEdit.4.4.2.9744\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.NRefactory, Version=5.0.0.0, Culture=neutral, PublicKeyToken=d4bfe873e7598c49, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand All @@ -96,14 +93,20 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
<Reference Include="Xceed.Wpf.AvalonDock">
<HintPath>..\..\Lib\Extended.Wpf.Toolkit.2.0.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
<Reference Include="Xceed.Wpf.AvalonDock, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010">
<HintPath>..\..\Lib\Extended.Wpf.Toolkit.2.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
<Reference Include="Xceed.Wpf.DataGrid">
<HintPath>..\..\Lib\Extended.Wpf.Toolkit.2.1.0\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit">
<HintPath>..\..\Lib\Extended.Wpf.Toolkit.2.0.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
<Reference Include="Xceed.Wpf.Toolkit, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Extended.Wpf.Toolkit.2.1.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
<Reference Include="XhtmlDumper">
<HintPath>..\..\Lib\XhtmlDumper.dll</HintPath>
Expand Down Expand Up @@ -326,6 +329,10 @@
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CShellCore.CodeCompletion\CShellCore.CodeCompletion.csproj">
<Project>{2adf8e19-b896-4778-8391-bc55fb100852}</Project>
<Name>CShellCore.CodeCompletion</Name>
</ProjectReference>
<ProjectReference Include="..\CShellCore\CShellCore.csproj">
<Project>{5D2479EA-0D1E-4381-AD9C-998CCEC2DC21}</Project>
<Name>CShellCore</Name>
Expand Down
5 changes: 2 additions & 3 deletions Src/CShell/Modules/Editors/ViewModels/EditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
using CShell.Framework;
using CShell.Framework.Services;
using CShell.Modules.Editors.Views;
using CShellCore.CodeCompletion;
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using Execute = CShell.Framework.Services.Execute;
using ICSharpCode.CodeCompletion;

namespace CShell.Modules.Editors.ViewModels
{
Expand Down Expand Up @@ -112,8 +112,7 @@ protected override void OnViewLoaded(object view)
editorView = (EditorView)view;
textEditor = editorView.textEditor;
if(System.IO.File.Exists(path))
textEditor.Load(path);
textEditor.Document.FileName = path;
textEditor.OpenFile(path);
originalText = textEditor.Text;

textEditor.TextChanged += delegate
Expand Down
4 changes: 2 additions & 2 deletions Src/CShell/Modules/Editors/Views/EditorView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:completion="clr-namespace:ICSharpCode.CodeCompletion;assembly=ICSharpCode.CodeCompletion"
xmlns:codeCompletion="clr-namespace:CShellCore.CodeCompletion;assembly=CShellCore.CodeCompletion"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<completion:CodeTextEditor
<codeCompletion:CodeTextEditor
Name="textEditor"
FontFamily="Consolas"
SyntaxHighlighting="C#"
Expand Down
1 change: 0 additions & 1 deletion Src/CShell/Modules/Editors/Views/EditorView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using CShell.Modules.Editors.ViewModels;
using ICSharpCode.AvalonEdit.CodeCompletion;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.CodeCompletion;

namespace CShell.Modules.Editors.Views
{
Expand Down
1 change: 0 additions & 1 deletion Src/CShell/Modules/Repl/Controls/CSRepl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:completion="clr-namespace:ICSharpCode.CodeCompletion;assembly=ICSharpCode.CodeCompletion"
xmlns:controls="clr-namespace:CShell.Modules.Repl.Controls"
mc:Ignorable="d"
d:DesignHeight="356" d:DesignWidth="575">
Expand Down
4 changes: 2 additions & 2 deletions Src/CShell/Modules/Repl/Controls/CSRepl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public CSRepl()
textEditor.TextArea.PreviewKeyDown += TextAreaOnPreviewKeyDown;
textEditor.IsEnabled = false;
textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
textEditor.Document.FileName = "repl.csx";
textEditor.FileName = "repl.csx";
textEditor.Repl = this;
this.Content = textEditor;

Expand Down Expand Up @@ -434,7 +434,7 @@ internal IDocument GetCompletionDocument(out int offset)
var vars = ScriptingEngine.GetVars();
var code = vars + lineText;
offset += vars.Length;
var doc = new ReadOnlyDocument(new StringTextSource(code), textEditor.Document.FileName);
var doc = new ReadOnlyDocument(new ICSharpCode.NRefactory.Editor.StringTextSource(code), textEditor.FileName);
return doc;
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion Src/CShell/Modules/Repl/Controls/CSReplTextEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ICSharpCode.CodeCompletion;
using CShellCore.CodeCompletion;
using ICSharpCode.NRefactory.Editor;
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion Src/CShell/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Arnova")]
[assembly: AssemblyProduct("CShell")]
[assembly: AssemblyCopyright("Copyright © Arnova Asset Management Ltd 2013")]
[assembly: AssemblyCopyright("Copyright © Arnova Asset Management Ltd 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
5 changes: 3 additions & 2 deletions Src/CShell/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AvalonDock" version="2.0.2000" targetFramework="net40" />
<package id="AvalonDock" version="2.0.2000" targetFramework="net45" />
<package id="AvalonEdit" version="4.4.2.9744" targetFramework="net45" />
<package id="Caliburn.Micro" version="1.5.2" targetFramework="net40" />
<package id="Extended.Wpf.Toolkit" version="2.0.0" targetFramework="net40" />
<package id="Extended.Wpf.Toolkit" version="2.1.0" targetFramework="net45" />
</packages>
Loading

0 comments on commit d75dcca

Please sign in to comment.