Skip to content

Commit e417df4

Browse files
committed
Cleanup + fix file lookup in sourcemap
Fixes #88
1 parent 114737d commit e417df4

File tree

3 files changed

+1
-20
lines changed

3 files changed

+1
-20
lines changed

src/Workspace.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@
22
#include <limits.h>
33
#include "LSP/Workspace.hpp"
44

5-
/// Checks whether a provided file is part of the workspace
6-
bool WorkspaceFolder::isInWorkspace(const lsp::DocumentUri& file)
7-
{
8-
if (file == rootUri)
9-
return true;
10-
11-
// Check if the root uri is a prefix of the file
12-
auto prefixStr = rootUri.toString();
13-
auto checkStr = file.toString();
14-
if (checkStr.compare(0, prefixStr.size(), prefixStr) == 0)
15-
{
16-
return true;
17-
}
18-
return false;
19-
}
20-
215
void WorkspaceFolder::openTextDocument(const lsp::DocumentUri& uri, const lsp::DidOpenTextDocumentParams& params)
226
{
237
auto moduleName = fileResolver.getModuleName(uri);

src/WorkspaceFileResolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void WorkspaceFileResolver::writePathsToMap(const SourceNodePtr& node, const std
288288
if (auto realPath = node->getScriptFilePath())
289289
{
290290
std::error_code ec;
291-
auto canonicalName = std::filesystem::weakly_canonical(*realPath, ec);
291+
auto canonicalName = std::filesystem::weakly_canonical(rootUri.fsPath() / *realPath, ec);
292292
if (ec.value() != 0)
293293
canonicalName = *realPath;
294294
realPathsToSourceNodes[canonicalName.generic_string()] = node;

src/include/LSP/Workspace.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ class WorkspaceFolder
4444
// Sets up the workspace folder after receiving configuration information
4545
void setupWithConfiguration(const ClientConfiguration& configuration);
4646

47-
/// Checks whether a provided file is part of the workspace
48-
bool isInWorkspace(const lsp::DocumentUri& file);
49-
5047
void openTextDocument(const lsp::DocumentUri& uri, const lsp::DidOpenTextDocumentParams& params);
5148
void updateTextDocument(
5249
const lsp::DocumentUri& uri, const lsp::DidChangeTextDocumentParams& params, std::vector<Luau::ModuleName>* markedDirty = nullptr);

0 commit comments

Comments
 (0)