...
This commit is contained in:
@@ -7,7 +7,7 @@ namespace NubLang.LSP;
|
||||
public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
{
|
||||
private readonly Dictionary<string, SyntaxTree> _syntaxTrees = new();
|
||||
private readonly Dictionary<string, CompilationUnit> _compilationUnits = new();
|
||||
private readonly Dictionary<string, List<TopLevelNode>> _compilationUnits = new();
|
||||
|
||||
public void Init(string rootPath)
|
||||
{
|
||||
@@ -35,14 +35,7 @@ public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
var result = typeChecker.Check();
|
||||
diagnosticsPublisher.Publish(fsPath, typeChecker.Diagnostics);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_compilationUnits.Remove(fsPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
_compilationUnits[fsPath] = result;
|
||||
}
|
||||
_compilationUnits[fsPath] = result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,14 +59,7 @@ public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
var result = typeChecker.Check();
|
||||
diagnosticsPublisher.Publish(fsPath, typeChecker.Diagnostics);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_compilationUnits.Remove(fsPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
_compilationUnits[fsPath] = result;
|
||||
}
|
||||
_compilationUnits[fsPath] = result;
|
||||
}
|
||||
|
||||
public void RemoveFile(DocumentUri path)
|
||||
@@ -83,7 +69,7 @@ public class WorkspaceManager(DiagnosticsPublisher diagnosticsPublisher)
|
||||
_compilationUnits.Remove(fsPath);
|
||||
}
|
||||
|
||||
public CompilationUnit? GetCompilationUnit(DocumentUri path)
|
||||
public List<TopLevelNode>? GetCompilationUnit(DocumentUri path)
|
||||
{
|
||||
return _compilationUnits.GetValueOrDefault(path.GetFileSystemPath());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user