...
This commit is contained in:
@@ -164,7 +164,7 @@ pub const Server = struct {
|
||||
const doc = self.documents.get(file_path) orelse {
|
||||
return try self.sendResponse(id_json, "null");
|
||||
};
|
||||
const sema = doc.sema orelse {
|
||||
const sema = doc.sema orelse doc.last_good_sema orelse {
|
||||
return try self.sendResponse(id_json, "null");
|
||||
};
|
||||
|
||||
@@ -420,7 +420,9 @@ pub const Server = struct {
|
||||
}
|
||||
|
||||
// Regular completion: all in-scope symbols + keywords
|
||||
const sema = doc.sema orelse {
|
||||
// Fall back to last successful analysis when current parse/analysis fails
|
||||
// (common while user is mid-typing)
|
||||
const sema = doc.sema orelse doc.last_good_sema orelse {
|
||||
return try self.sendResponse(id_json, "[]");
|
||||
};
|
||||
|
||||
@@ -490,7 +492,7 @@ pub const Server = struct {
|
||||
var items = std.ArrayList(lsp.CompletionItem).empty;
|
||||
|
||||
if (extractDotPrefix(doc.source, cursor_offset)) |prefix| {
|
||||
if (doc.sema) |sema| {
|
||||
if (doc.sema orelse doc.last_good_sema) |sema| {
|
||||
// Check if prefix is a namespace — offer imported doc's declarations
|
||||
if (self.findImportByNs(doc, prefix)) |imp| {
|
||||
if (self.documents.get(imp.path)) |imp_doc| {
|
||||
|
||||
Reference in New Issue
Block a user