
I developed it according to the official documents and examples, and this is the code:
Friend Sub InitializeSyntaxEditor()
If AmbientParseRequestDispatcherProvider.Dispatcher Is Nothing Then
AmbientParseRequestDispatcherProvider.Dispatcher = New Implementation.ThreadedParseRequestDispatcher()
Dim appDataPath As String = IO.Path.Combine(IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Foxtable CodeStudio"), "Assembly Repository")
AmbientAssemblyRepositoryProvider.Repository = New Implementation.FileBasedAssemblyRepository(appDataPath)
End If
Me.AreIndentationGuidesVisible = True
Me.AreMultipleSelectionRangesEnabled = False
Me.IsLineNumberMarginVisible = True
Me.CanCutCopyDragWithHtml = True
Me.LineNumberMarginMinWidth = 24
Dim language As New VBSyntaxLanguage()
projectAssembly = language.GetService(Of IProjectAssembly)
Dim assemblyLoader As New BackgroundWorker()
AddHandler assemblyLoader.DoWork, AddressOf DotNetProjectAssemblyReferenceLoader
assemblyLoader.RunWorkerAsync()
Me.Document.Language = language
Me.Document.FileName = Rand.NextString(10) & ".vb"
End Sub
Private Sub DotNetProjectAssemblyReferenceLoader(ByVal sender As Object, ByVal e As DoWorkEventArgs)
projectAssembly.AssemblyReferences.AddMsCorLib()
projectAssembly.AssemblyReferences.Add("System")
For Each fl As String In SysInfo.referFiles.Split(New Char() {ControlChars.Lf, ControlChars.Cr }, System.StringSplitOptions.RemoveEmptyEntries)
fl = IO.Path.GetFileNameWithoutExtension(fl)
If projectAssembly.AssemblyReferences.Add(fl) Is Nothing Then
projectAssembly.AssemblyReferences.Add(Assembly.LoadWithPartialName(fl))
End If
Next
End Sub
In addition, in order to solve the bug of with statement, I rewritten the "vbcompletionprovider" class. The code is:
Friend Class foxVBCompletionProvider
Inherits VBCompletionProvider
Public Overrides Function RequestSession(view As IEditorView, canCommitWithoutPopup As Boolean) As Boolean
If WithStatement Then
''' other code
Else
Return MyBase.RequestSession(view, canCommitWithoutPopup)
End If
End Function
End Class
When the "Return MyBase.RequestSession(view, canCommitWithoutPopup)" is executed, the program will lose the response.
In fact, if I do not follow the official document to design, when the reflection cache data be loading , other codes cannot be entered too.
In addition, once the program loses response, no matter how long you wait, it will not return to normal and will always be in a state of losing response
[Modified 3 years ago]