Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/slluis/fsharpbinding
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Guerra committed Oct 19, 2011
2 parents 088f2ab + e892cba commit 1532fb2
Show file tree
Hide file tree
Showing 19 changed files with 168 additions and 130 deletions.
24 changes: 15 additions & 9 deletions src/FSharp.MonoDevelop.fsproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<RootNamespace>FSharp.MonoDevelop</RootNamespace>
<AssemblyName>FSharpBinding</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Name>FSharp.MonoDevelop</Name>
<UsePartialTypes>false</UsePartialTypes>
<BuildOrder>
Expand Down Expand Up @@ -78,6 +78,7 @@
<GenerateXmlDoc>false</GenerateXmlDoc>
<GenerateTailCalls>false</GenerateTailCalls>
<OutputPath>..\bin\</OutputPath>
<PostBuildEvent />
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\fsharp-icon-32.png" />
Expand Down Expand Up @@ -112,46 +113,51 @@
<Compile Include="FSharpParser.fs" />
<Compile Include="FSharpTextEditorCompletion.fs" />
<Compile Include="FSharpResolverProvider.fs" />
<Compile Include="FSharpProjectServiceExtension.fs" />
<Compile Include="FSharpProjectFileNodeExtension.fs" />
</ItemGroup>
<ItemGroup>
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="System.Core" />
<Reference Include="Mono.Cairo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<Reference Include="Mono.TextEditor">
<HintPath>/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/bin/Mono.TextEditor.dll</HintPath>
<HintPath>/usr/lib/monodevelop/bin/Mono.TextEditor.dll</HintPath>
<HintPath>C:\Program Files\MonoDevelop\bin\Mono.TextEditor.dll</HintPath>
<HintPath>C:\Program Files (x86)\MonoDevelop\bin\Mono.TextEditor.dll</HintPath>
<Package>monodevelop</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="MonoDevelop.Core">
<HintPath>/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Core.dll</HintPath>
<HintPath>/usr/lib/monodevelop/bin/MonoDevelop.Core.dll</HintPath>
<HintPath>C:\Program Files\MonoDevelop\bin\MonoDevelop.Core.dll</HintPath>
<HintPath>C:\Program Files (x86)\MonoDevelop\bin\MonoDevelop.Core.dll</HintPath>
<Package>monodevelop</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="MonoDevelop.Ide">
<HintPath>/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/bin/MonoDevelop.Ide.dll</HintPath>
<HintPath>/usr/lib/monodevelop/bin/MonoDevelop.Ide.dll</HintPath>
<HintPath>C:\Program Files\MonoDevelop\bin\MonoDevelop.Ide.dll</HintPath>
<HintPath>C:\Program Files (x86)\MonoDevelop\bin\MonoDevelop.Ide.dll</HintPath>
<Package>monodevelop</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="Mono.Cairo" />
<Reference Include="Mono.Addins, Version=0.6.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="Gui\FSharp.MonoDevelop.Gui.csproj">
<Name>FSharp.MonoDevelop.Gui</Name>
<Project>{fd0d1033-9145-48e5-8ed8-e2365252878c}</Project>
<Private>True</Private>
<Project>{FD0D1033-9145-48E5-8ED8-E2365252878C}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugInstall|AnyCPU' ">
<PostBuildEvent></PostBuildEvent>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions src/FSharp.MonoDevelop.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{4925A630-B079-445d-BCD4-3A9C94FE9307}") = "FSharp.MonoDevelop", "FSharp.MonoDevelop.fsproj", "{4c10f8f9-3816-4647-ba6e-85f5de39883a}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSharp.MonoDevelop.Gui", "Gui\FSharp.MonoDevelop.Gui.csproj", "{FD0D1033-9145-48E5-8ED8-E2365252878C}"
Expand Down
16 changes: 7 additions & 9 deletions src/FSharpInteractivePad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ type FSharpInteractivePad() =
let mutable enterHandler = { new IDisposable with member x.Dispose() = () }

let AddSourceToSelection selection =
let line = ref 0
let col = ref 0
let stap = IdeApp.Workbench.ActiveDocument.TextEditor.SelectionStartPosition
IdeApp.Workbench.ActiveDocument.TextEditor.GetLineColumnFromPosition(stap, line, col)
let stap = IdeApp.Workbench.ActiveDocument.Editor.SelectionRange.Offset
let line = IdeApp.Workbench.ActiveDocument.Editor.GetLineByOffset(stap)
let file = IdeApp.Workbench.ActiveDocument.FileName
String.Format("# {0} \"{1}\"\n{2}" ,line.Value ,file.FullPath,selection)
String.Format("# {0} \"{1}\"\n{2}" ,line ,file.FullPath,selection)

let rec setupReleaseHandler (ea:Gtk.KeyReleaseEventArgs) =
enterHandler.Dispose()
Expand Down Expand Up @@ -123,16 +121,16 @@ type FSharpInteractivePad() =

member x.SendSelection() =
if x.IsSelectionNonEmpty then
let sel = IdeApp.Workbench.ActiveDocument.TextEditor.SelectedText
let sel = IdeApp.Workbench.ActiveDocument.Editor.SelectedText
x.EnsureCorrectDirectory()
sendCommand (AddSourceToSelection sel) false

member x.SendLine() =
if IdeApp.Workbench.ActiveDocument = null then ()
else
x.EnsureCorrectDirectory()
let line = IdeApp.Workbench.ActiveDocument.TextEditor.CursorLine
let text = IdeApp.Workbench.ActiveDocument.TextEditor.GetLineText(line)
let line = IdeApp.Workbench.ActiveDocument.Editor.Caret.Line
let text = IdeApp.Workbench.ActiveDocument.Editor.GetLineText(line)
let file = IdeApp.Workbench.ActiveDocument.FileName
let sel = String.Format("# {0} \"{1}\"\n{2}" ,line ,file.FullPath,text)
sendCommand sel false
Expand All @@ -141,7 +139,7 @@ type FSharpInteractivePad() =
if IdeApp.Workbench.ActiveDocument = null ||
IdeApp.Workbench.ActiveDocument.FileName.FileName = null then false
else
let sel = IdeApp.Workbench.ActiveDocument.TextEditor.SelectedText
let sel = IdeApp.Workbench.ActiveDocument.Editor.SelectedText
not(String.IsNullOrEmpty(sel))

member x.IsInsideFSharpFile =
Expand Down
6 changes: 5 additions & 1 deletion src/FSharpLanguageBinding.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open MonoDevelop.Ide
open MonoDevelop.Ide.Gui.Content
open MonoDevelop.Projects
open Microsoft.FSharp.Compiler
open Mono.Addins

type FSharpLanguageBinding() =
static let LanguageName = "F#"
Expand All @@ -29,7 +30,7 @@ type FSharpLanguageBinding() =
// Trigger full parse using the current configuration
let config = IdeApp.Workspace.ActiveConfiguration
Debug.tracef "Parsing" "Triggering full parse from OnIdle"
LanguageService.Service.TriggerParse(doc.FileName, doc.TextEditor.Text, doc.Dom, config, full=true)
LanguageService.Service.TriggerParse(doc.FileName, doc.Editor.Text, doc.Dom, config, full=true)
true

// Create or remove Idle timer
Expand Down Expand Up @@ -81,4 +82,7 @@ type FSharpLanguageBinding() =
member x.GetSupportedClrVersions() =
[| ClrVersion.Net_2_0; ClrVersion.Net_4_0 |]

member x.GetImplicitAssemblyReferences() =
Seq.singleton (AddinManager.CurrentAddin.GetFilePath("FSharp.Core.dll"))

member x.ProjectStockIcon = "md-fs-project"
2 changes: 1 addition & 1 deletion src/FSharpParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type FSharpParsedDocument(fileName) =
inherit ParsedDocument(fileName)

type FSharpParser() =
inherit AbstractParser("F#", "text/x-fsharp")
inherit AbstractParser()

override x.CanParse(fileName) =
Common.supportedExtension(IO.Path.GetExtension(fileName))
Expand Down
27 changes: 27 additions & 0 deletions src/FSharpProjectFileNodeExtension.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace FSharp.MonoDevelop

open System
open System.IO
open MonoDevelop.Core
open MonoDevelop.Ide.Gui.Components
open MonoDevelop.Projects

type FSharpProjectFileNodeExtension() =
inherit NodeBuilderExtension()

override x.CanBuildNode(dataType:Type) =
// Extend any file belonging to a F# project
typedefof<ProjectFile>.IsAssignableFrom (dataType)

override x.CompareObjects(thisNode:ITreeNavigator, otherNode:ITreeNavigator) : int =
if otherNode.DataItem :? ProjectFile then
let file1 = thisNode.DataItem :?> ProjectFile
let file2 = otherNode.DataItem :?> ProjectFile
if (file1.Project <> null) && (file1.Project = file2.Project) && (file1.Project :? DotNetProject) && ((file1.Project :?> DotNetProject).LanguageName = "F#") then
file1.Project.Files.IndexOf(file1).CompareTo(file2.Project.Files.IndexOf(file2))
else
NodeBuilder.DefaultSort
else
NodeBuilder.DefaultSort


23 changes: 23 additions & 0 deletions src/FSharpProjectServiceExtension.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace FSharp.MonoDevelop

open System
open System.IO
open MonoDevelop.Core
open MonoDevelop.Ide
open MonoDevelop.Projects
open Mono.Addins

type FSharpProjectServiceExtension() =
inherit ProjectServiceExtension()

override x.SupportsItem(item:IBuildTarget) =
// Extend any F# project
(item :? DotNetProject) && (item :?> DotNetProject).LanguageName = "F#"

override x.PopulateSupportFileList(project:Project, list:FileCopySet, configuration:ConfigurationSelector) =
base.PopulateSupportFileList (project, list, configuration)
let outDir = (project.GetConfiguration (configuration) :?> ProjectConfiguration).OutputDirectory
let added = list.Add(new FilePath (AddinManager.CurrentAddin.GetFilePath("FSharp.Core.dll")), true)
()


2 changes: 1 addition & 1 deletion src/FSharpTextEditorCompletion.fs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type FSharpTextEditorCompletion() =
override x.CodeCompletionCommand(context:CodeCompletionContext) : ICompletionDataList =
try
let config = IdeApp.Workspace.ActiveConfiguration
let req = x.Document.FileName, x.Document.TextEditor.Text, x.Document.Dom, config
let req = x.Document.FileName, x.Document.Editor.Text, x.Document.Dom, config

// Try to get typed information from LanguageService (with the specified timeout)
let tyRes = LanguageService.Service.GetTypedParseResult(req, timeout = ServiceSettings.blockingTimeout)
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/FSharp.MonoDevelop.Gui.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
24 changes: 8 additions & 16 deletions src/Gui/gtk-gui/FSharp.MonoDevelop.Gui.FSharpBuildOrderWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ namespace FSharp.MonoDevelop.Gui
public partial class FSharpBuildOrderWidget
{
private global::Gtk.Frame frame2;

private global::Gtk.Alignment GtkAlignment;

private global::Gtk.VBox vbox2;

private global::Gtk.ScrolledWindow GtkScrolledWindow;

private global::Gtk.TreeView treeItemList;

private global::Gtk.HBox hbox1;

private global::Gtk.Button btnDown;

private global::Gtk.Button btnUp;

private global::Gtk.Label GtkLabel2;

protected virtual void Build ()
Expand All @@ -33,7 +25,7 @@ protected virtual void Build ()
this.frame2.Name = "frame2";
this.frame2.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child frame2.Gtk.Container+ContainerChild
this.GtkAlignment = new global::Gtk.Alignment (0f, 0f, 1f, 1f);
this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
this.GtkAlignment.Name = "GtkAlignment";
this.GtkAlignment.LeftPadding = ((uint)(12));
this.GtkAlignment.TopPadding = ((uint)(6));
Expand All @@ -53,7 +45,7 @@ protected virtual void Build ()
this.treeItemList.HeadersVisible = false;
this.GtkScrolledWindow.Add (this.treeItemList);
this.vbox2.Add (this.GtkScrolledWindow);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.GtkScrolledWindow]));
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.GtkScrolledWindow]));
w2.Position = 0;
// Container child vbox2.Gtk.Box+BoxChild
this.hbox1 = new global::Gtk.HBox ();
Expand All @@ -65,9 +57,9 @@ protected virtual void Build ()
this.btnDown.CanFocus = true;
this.btnDown.Name = "btnDown";
this.btnDown.UseUnderline = true;
this.btnDown.Label = "Down";
this.btnDown.Label = global::Mono.Unix.Catalog.GetString ("Down");
this.hbox1.Add (this.btnDown);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnDown]));
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnDown]));
w3.Position = 1;
w3.Expand = false;
w3.Fill = false;
Expand All @@ -77,22 +69,22 @@ protected virtual void Build ()
this.btnUp.CanFocus = true;
this.btnUp.Name = "btnUp";
this.btnUp.UseUnderline = true;
this.btnUp.Label = "Up";
this.btnUp.Label = global::Mono.Unix.Catalog.GetString ("Up");
this.hbox1.Add (this.btnUp);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnUp]));
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnUp]));
w4.Position = 2;
w4.Expand = false;
w4.Fill = false;
this.vbox2.Add (this.hbox1);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1]));
w5.Position = 1;
w5.Expand = false;
w5.Fill = false;
this.GtkAlignment.Add (this.vbox2);
this.frame2.Add (this.GtkAlignment);
this.GtkLabel2 = new global::Gtk.Label ();
this.GtkLabel2.Name = "GtkLabel2";
this.GtkLabel2.LabelProp = "<b>Build order</b>";
this.GtkLabel2.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Build order</b>");
this.GtkLabel2.UseMarkup = true;
this.frame2.LabelWidget = this.GtkLabel2;
this.Add (this.frame2);
Expand Down
Loading

0 comments on commit 1532fb2

Please sign in to comment.