Skip to content
This repository was archived by the owner on Jan 3, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.orig
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@ package:
mkdir -p repository
cp bin/FSharpBinding.* bin/repository
cp src/Resources/FSharpBinding.addin.xml bin/repository
cp src/Resources/addin.info bin/repository
$(MDRUN) setup pack bin/repository/FSharpBinding.addin.xml -d:repository

5 changes: 4 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
F# Language Binding for MonoDevelop
Released under the Apache 2.0 License

For more information visit http://functional-variations.net/monodevelop and http://tomasp.net/blog.
For more information visit http://functional-variations.net/monodevelop and http://tomasp.net/blog.

Manually creating package file:
To create an addin, pack the FSharpBinding.dll (from build's bin folder), FSharpBinding.Gui.dll (from build's bin folder), FSharpBinding.addin.xml (from FSharp.MonoDevelop/Resources) and addin.info (from FSharp.MonoDevelop/Resources) files to a zip file and change the extension to mpack.
11 changes: 7 additions & 4 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">
<?xml version="1.0" encoding="utf-8"?>
<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 @@ -90,6 +90,9 @@
<EmbeddedResource Include="Resources\EmptyFSharpScript.xft.xml" />
<EmbeddedResource Include="Resources\FSharpConsoleProject.xpt.xml" />
<EmbeddedResource Include="Resources\FSharpSyntaxMode.xml" />
<None Include="Resources\addin.info">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Include="PowerPack\CodeDomVisitor.fs" />
<Compile Include="PowerPack\CodeDomGenerator.fs" />
<Compile Include="PowerPack\CodeProvider.fs" />
Expand All @@ -116,7 +119,7 @@
<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="mscorlib" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="System" />
<Reference Include="System.Xml" />
Expand Down
21 changes: 12 additions & 9 deletions src/FSharpInteractivePad.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ 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 line = ref 0
//let col = ref 0
let stap = IdeApp.Workbench.ActiveDocument.Editor.SelectionRange.Offset
//IdeApp.Workbench.ActiveDocument.TextEditor.GetLineColumnFromPosition(stap, line, col)
//let loc = IdeApp.Workbench.ActiveDocument.Editor.OffsetToLocation stap
let line = IdeApp.Workbench.ActiveDocument.Editor.OffsetToLineNumber stap
//let col = loc.Column
let file = IdeApp.Workbench.ActiveDocument.FileName
String.Format("# {0} \"{1}\"\n{2}" ,line.Value ,file.FullPath,selection)
String.Format("# {0} \"{1}\"\n{2}" ,line(*.Value*) ,file.FullPath,selection)

let rec setupReleaseHandler (ea:Gtk.KeyReleaseEventArgs) =
enterHandler.Dispose()
Expand Down Expand Up @@ -123,16 +126,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 +144,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
2 changes: 1 addition & 1 deletion src/FSharpLanguageBinding.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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
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((*"F#", "text/x-fsharp"*))

override x.CanParse(fileName) =
Common.supportedExtension(IO.Path.GetExtension(fileName))
Expand Down
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
4 changes: 2 additions & 2 deletions 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 All @@ -8,7 +8,7 @@
<ProjectGuid>{FD0D1033-9145-48E5-8ED8-E2365252878C}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>FSharpBinding.Gui</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<RootNamespace>FSharp.MonoDevelop.Gui</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/FSharpBinding.addin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
</Runtime>

<Dependencies>
<Addin id="Core" version="2.4"/>
<Addin id="Ide" version="2.4"/>
<Addin id="SourceEditor2" version="2.4"/>
<Addin id="Core" version="2.6"/>
<Addin id="Ide" version="2.6"/>
<Addin id="SourceEditor2" version="2.6"/>
</Dependencies>

<Extension path="/MonoDevelop/ProjectModel/MSBuildItemTypes">
Expand Down
23 changes: 23 additions & 0 deletions src/Resources/addin.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Addin id="FSharpBinding" namespace="MonoDevelop" name="F# Language Binding" author="Community" copyright="???" url="http://www.fsharp.net" description="F# Language Binding" category="Language bindings" version="2.6" flags="None">
<Runtime>
<Import assembly="FSharpBinding.dll" />
<Import assembly="FSharpBinding.Gui.dll" />
</Runtime>
<Dependencies>
<Addin id="Core" version="2.6" />
<Addin id="Ide" version="2.6" />
<Addin id="SourceEditor2" version="2.6" />
</Dependencies>
<!--
<Extension path="/MonoDevelop/ProjectModel/MD1SerializationMaps">
<SerializationMap resource="md1format.xml" />
</Extension>
-->
<!--
<Extension path="/MonoDevelop/ProjectModel/DomParser">
<Class class="MonoDevelop.FSharpBinding.DomParser" />
</Extension>
-->
<!-- F# interactive -->
</Addin>
10 changes: 5 additions & 5 deletions src/Services/LanguageService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,21 @@ type internal TypedParseResult(info:TypeCheckInfo) =
/// Get declarations at the current location in the specified document
/// (used to implement dot-completion in 'FSharpTextEditorCompletion.fs')
member x.GetDeclarations(doc:Document) =
let lineStr = doc.TextEditor.GetLineText(doc.TextEditor.CursorLine)
let lineStr = doc.Editor.GetLineText(doc.Editor.Caret.Line)

// Get the long identifier before the current location
// 'residue' is the part after the last dot and 'longName' is before
// e.g. System.Console.Wri --> "Wri", [ "System"; "Console"; ]
let lookBack = Parsing.createBackStringReader lineStr (doc.TextEditor.CursorColumn - 2)
let lookBack = Parsing.createBackStringReader lineStr (doc.Editor.Caret.Column - 2)
let residue, longName =
lookBack
|> Parsing.getFirst Parsing.parseBackIdentWithResidue

Debug.tracef "Result" "GetDeclarations: column: %d, ident: %A\n Line: %s"
(doc.TextEditor.CursorLine - 1) (longName, residue) lineStr
(doc.Editor.Caret.Line - 1) (longName, residue) lineStr
let res =
info.GetDeclarations
( (doc.TextEditor.CursorLine - 1, doc.TextEditor.CursorColumn - 1),
( (doc.Editor.Caret.Line - 1, doc.Editor.Caret.Column - 1),
lineStr, (longName, residue), 0) // 0 is tokenTag, which is ignored in this case

Debug.tracef "Result" "GetDeclarations: returning %d items" res.Items.Length
Expand Down Expand Up @@ -412,7 +412,7 @@ type internal LanguageService private () =
Debug.tracef "Errors" "Trigger update after completion"
let doc = IdeApp.Workbench.ActiveDocument
if doc.FileName.FullPath = file.FullPath then
ProjectDomService.Parse(file.ToString(), "text/x-fsharp", fun () -> doc.TextEditor.Text) |> ignore
ProjectDomService.Parse(file.ToString(), (*"text/x-fsharp",*) fun () -> doc.Editor.Text) |> ignore
updatingErrors <- false

// ------------------------------------------------------------------------------------
Expand Down