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
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
},
{
"category": 1,
"message": "{\"jsonrpc\":\"2.0\",\"method\":\"typecobol/missingCopies\",\"params\":{\"textDocument\":{\"uri\":\"file:///C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"},\"Copies\":[\"YDVZERL\",\"YSTIEM1\"]}}"
"message": "{\"jsonrpc\":\"2.0\",\"method\":\"typecobol/missingCopies\",\"params\":{\"textDocument\":{\"uri\":\"file:///C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"},\"Copies\":[\"YDVZERL\",\"YSTIEM1\"],\"CpyCopies\":[]}}"
},
{
"category": 0,
"message": "{\"jsonrpc\":\"2.0\",\"method\":\"typecobol/extractusecopy\",\"params\":{\"textDocument\":{\"uri\":\"file:/C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"}}}"
},
{
"category": 1,
"message": "{\"jsonrpc\":\"2.0\",\"method\":\"typecobol/missingCopies\",\"params\":{\"textDocument\":{\"uri\":\"file:/C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"},\"Copies\":[\"YDVZERL\",\"YSTIEM1\"]}}"
"message": "{\"jsonrpc\":\"2.0\",\"method\":\"typecobol/missingCopies\",\"params\":{\"textDocument\":{\"uri\":\"file:/C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"},\"Copies\":[\"YDVZERL\",\"YSTIEM1\"],\"CpyCopies\":[]}}"
}
],
"didClose": "{\"jsonrpc\":\"2.0\",\"method\":\"textDocument/didClose\",\"params\":{\"textDocument\":{\"uri\":\"file:/C:/Users/BALLMA/AppData/Local/Temp/1/tcbl/DVZZBCO04742822857809968410.cee\"}}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ class MissingCopiesParams
/// List of missing copies
/// </summary>
public List<string> Copies { get; set; }
/// <summary>
/// List of missing CPY copies
/// </summary>
public List<string> CpyCopies { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,7 @@ protected virtual void OnDidReceiveExtractUseCopies(ExtractUseCopiesParams param

List<string> copiesName = docContext.FileCompiler.CompilationResultsForProgram.CopyTextNamesVariations.Select(cp => cp.TextNameWithSuffix).Distinct().ToList();
copiesName.AddRange(dependenciesMissingCopies);
if (copiesName.Count > 0)
{
var missingCopiesParam = new MissingCopiesParams();
missingCopiesParam.textDocument = parameter.textDocument;
missingCopiesParam.Copies = copiesName;
this.RpcServer.SendNotification(MissingCopiesNotification.Type, missingCopiesParam);
}
MissingCopiesDetected(parameter.textDocument, copiesName);
}
}

Expand Down
24 changes: 20 additions & 4 deletions TypeCobol.LanguageServer/TypeCobolServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ private void WarningTrigger(object sender, string message)
this.NotifyWarning(message);
}

protected void MissingCopiesDetected(TextDocumentIdentifier textDocument, List<string> copiesName)
{
if (copiesName.Count > 0)
{
var missingCopiesParam = new MissingCopiesParams();
missingCopiesParam.textDocument = textDocument;

#if EUROINFO_RULES
ILookup<bool, string> lookup = copiesName.ToLookup(s => Workspace.CompilationProject.CompilationOptions.HasCpyCopy(s));
missingCopiesParam.Copies = lookup[false].ToList();
missingCopiesParam.CpyCopies = lookup[true].ToList();
#else
missingCopiesParam.Copies = copiesName;
missingCopiesParam.CpyCopies = new List<string>();
#endif
this.RpcServer.SendNotification(MissingCopiesNotification.Type, missingCopiesParam);
}
}

/// <summary>
/// Event Method triggered when missing copies are detected.
/// </summary>
Expand All @@ -175,10 +194,7 @@ private void MissingCopiesDetected(object fileUri, MissingCopiesEvent missingCop
//This event can be used when a dependency have not been loaded

//Send missing copies to client
var missingCopiesParam = new MissingCopiesParams();
missingCopiesParam.Copies = missingCopiesEvent.Copies;
missingCopiesParam.textDocument = new TextDocumentIdentifier(fileUri.ToString());
this.RpcServer.SendNotification(MissingCopiesNotification.Type, missingCopiesParam);
MissingCopiesDetected(new TextDocumentIdentifier(fileUri.ToString()), missingCopiesEvent.Copies);
}

/// <summary>
Expand Down