Skip to content
Merged
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
8 changes: 4 additions & 4 deletions TypeCobol.LanguageServer/TypeCobolServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ protected override InitializeResult OnInitialize(InitializeParams parameters)
this.Workspace.ExceptionTriggered += ExceptionTriggered;
this.Workspace.WarningTrigger += WarningTrigger;
this.Workspace.MissingCopiesEvent += MissingCopiesDetected;
this.Workspace.DiagnosticsEvent += DiagnosticsDetected;
this.Workspace.LoadCustomAnalyzers(CustomAnalyzerFiles);

// Return language server capabilities
Expand All @@ -278,6 +279,9 @@ protected override InitializeResult OnInitialize(InitializeParams parameters)

protected override void OnShutdown()
{
this.Workspace.LoadingIssueEvent -= LoadingIssueDetected;
this.Workspace.ExceptionTriggered -= ExceptionTriggered;
this.Workspace.WarningTrigger -= WarningTrigger;
this.Workspace.MissingCopiesEvent -= MissingCopiesDetected;
this.Workspace.DiagnosticsEvent -= DiagnosticsDetected;

Expand Down Expand Up @@ -307,9 +311,6 @@ protected override void OnDidOpenTextDocument(DidOpenTextDocumentParams paramete
DocumentContext docContext = new DocumentContext(parameters.textDocument);
if (docContext.Uri.IsFile && !this.Workspace.TryGetOpenedDocumentContext(docContext.Uri, out _))
{
//Subscribe to diagnostics event
this.Workspace.DiagnosticsEvent += DiagnosticsDetected;

//Create a ILanguageServer instance for the document.
docContext.LanguageServer = new TypeCobolLanguageServer(this.RpcServer, parameters.textDocument);
docContext.LanguageServer.UseSyntaxColoring = UseSyntaxColoring;
Expand Down Expand Up @@ -495,7 +496,6 @@ protected override void OnDidCloseTextDocument(DidCloseTextDocumentParams parame
if (objUri.IsFile)
{
this.Workspace.CloseSourceFile(objUri);
this.Workspace.DiagnosticsEvent -= DiagnosticsDetected;

// DEBUG information
RemoteConsole.Log("Closed source file : " + objUri.LocalPath);
Expand Down
12 changes: 6 additions & 6 deletions TypeCobol.LanguageServer/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public class Workspace

private List<FileCompiler> _fileCompilerWaittingForNodePhase;
public TypeCobolConfiguration Configuration { get; private set; }
public EventHandler<DiagnosticEvent> DiagnosticsEvent { get; set; }
public EventHandler<EventArgs> DocumentModifiedEvent { get; set; }
public EventHandler<MissingCopiesEvent> MissingCopiesEvent { get; set; }
public EventHandler<LoadingIssueEvent> LoadingIssueEvent { get; set; }
public EventHandler<ThreadExceptionEventArgs> ExceptionTriggered { get; set; }
public EventHandler<string> WarningTrigger { get; set; }
public event EventHandler<DiagnosticEvent> DiagnosticsEvent;
public event EventHandler<EventArgs> DocumentModifiedEvent;
public event EventHandler<MissingCopiesEvent> MissingCopiesEvent;
public event EventHandler<LoadingIssueEvent> LoadingIssueEvent;
public event EventHandler<ThreadExceptionEventArgs> ExceptionTriggered;
public event EventHandler<string> WarningTrigger;
public Queue<MessageActionWrapper> MessagesActionsQueue { get; private set; }
private Func<string, Uri, bool> _Logger;
/// <summary>
Expand Down