Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ trace.json
*.app

# Python venvs
.venv
.venv

# Test File
discard.luau
140 changes: 80 additions & 60 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,92 @@
{
"version": "0.2.0",
"configurations": [
// {
// "name": "Run Extension Standalone",
// "type": "extensionHost",
// "request": "launch",
// "args": [
// "--disable-extensions",
// "--extensionDevelopmentPath=${workspaceFolder}/editors/code"
// ],
// "outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
// "preLaunchTask": "npm: compile",
// "env": {
// "LUAU_LSP_SERVER_PATH": "${workspaceFolder}/${input:binaryPath}/luau-lsp"
// },
// "windows": {
// "env": {
// "LUAU_LSP_SERVER_PATH": "${workspaceFolder}/${input:binaryPath}/luau-lsp.exe"
// }
// }
// },
// {
// "name": "Run Extension",
// "type": "extensionHost",
// "request": "launch",
// "args": [
// "--disable-extensions",
// "--extensionDevelopmentPath=${workspaceFolder}/editors/code"
// ],
// "env": {
// "CMAKE_BUILD_TYPE": "${command:cmake.buildType}"
// },
// "outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
// "preLaunchTask": "Build Server and Extension"
// },
// {
// "name": "Extension Tests",
// "type": "extensionHost",
// "request": "launch",
// "args": [
// "--extensionDevelopmentPath=${workspaceFolder}/editors/code",
// "--extensionTestsPath=${workspaceFolder}/editors/code/dist/test/suite/index",
// "${workspaceFolder}/editors/code/testFixture"
// ],
// "outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
// "preLaunchTask": "tasks: watch-tests"
// },
// {
// "name": "Win Attach to Server",
// "type": "cppvsdbg",
// "processId": "${command:pickProcess}",
// "request": "attach"
// },
{
"name": "Run Extension Standalone",
"type": "extensionHost",
"name": "Run CLI Application (DEBUG)",
"type": "cppdbg",
"program": "${workspaceFolder}/build/Debug/luau-lsp.exe",
"environment": [{ "name": "config", "value": "Debug" }],
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
],
"outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
"preLaunchTask": "npm: compile",
"env": {
"LUAU_LSP_SERVER_PATH": "${workspaceFolder}/${input:binaryPath}/luau-lsp"
},
"windows": {
"env": {
"LUAU_LSP_SERVER_PATH": "${workspaceFolder}/${input:binaryPath}/luau-lsp.exe"
}
}
},
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
],
"env": {
"CMAKE_BUILD_TYPE": "${command:cmake.buildType}"
},
"outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
"preLaunchTask": "Build Server and Extension"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/editors/code",
"--extensionTestsPath=${workspaceFolder}/editors/code/dist/test/suite/index",
"${workspaceFolder}/editors/code/testFixture"
],
"outFiles": ["${workspaceFolder}/editors/code/dist/**/*.js"],
"preLaunchTask": "tasks: watch-tests"
},
{
"name": "Win Attach to Server",
"type": "cppvsdbg",
"processId": "${command:pickProcess}",
"request": "attach"
"cwd": "${workspaceRoot}",
"args": ["analyze", "--formatter", "prettier", "${input:test-file}"]
}
],
"inputs": [
// {
// "id": "binaryPath",
// "type": "pickString",
// "description": "Path to build folder containing 'luau-lsp'",
// "default": "cmake-build-relwithdebinfo-visual-studio",
// "options": [
// "cmake-build-debug-visual-studio",
// "cmake-build-release-visual-studio",
// "cmake-build-relwithdebinfo-visual-studio",
// "cmake-build-debug",
// "cmake-build-release",
// "cmake-build-relwithdebinfo"
// ]
// },
{
"id": "test-file",
"type": "promptString",
"description": "File to analyze",
"default": "discard.luau"
},
{
"id": "binaryPath",
"type": "pickString",
"description": "Path to build folder containing 'luau-lsp'",
"default": "cmake-build-relwithdebinfo-visual-studio",
"options": [
"cmake-build-debug-visual-studio",
"cmake-build-release-visual-studio",
"cmake-build-relwithdebinfo-visual-studio",
"cmake-build-debug",
"cmake-build-release",
"cmake-build-relwithdebinfo"
]
"id": "fflags",
"type": "promptString",
"description": "Flags for CL"
}
]
}
13 changes: 13 additions & 0 deletions src/AnalyzeCli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Analyze/AnalyzeCli.hpp"
#include "Analyze/CliConfigurationParser.hpp"
#include "Analyze/CliClient.hpp"
#include "Analyze/Reporter.hpp"
#include "Flags.hpp"

#include "LSP/ClientConfiguration.hpp"
Expand Down Expand Up @@ -29,6 +30,7 @@ enum class ReportFormat
Default,
Luacheck,
Gnu,
Prettier
};

static void report(ReportFormat format, const char* name, const Luau::Location& loc, const char* type, const char* message)
Expand All @@ -54,6 +56,15 @@ static void report(ReportFormat format, const char* name, const Luau::Location&
// Note: GNU end column is inclusive but our end column is exclusive
fprintf(stderr, "%s:%d.%d-%d.%d: %s: %s\n", name, loc.begin.line + 1, loc.begin.column + 1, loc.end.line + 1, loc.end.column, type, message);
break;

case ReportFormat::Prettier:
// Use Reporter.hpp to create new reporter error
auto file = new reporter::SimpleFile(name);
auto err = reporter::Error(
type, message,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the top line should include the error message, rather than just TypeError - i think that should go as part of the code.

{ loc.begin.line, loc.begin.column, loc.end.column, file }
);
err.print(std::cerr);
}
}

Expand Down Expand Up @@ -221,6 +232,8 @@ int startAnalyze(const argparse::ArgumentParser& program)
format = ReportFormat::Luacheck;
else if (reportFormatter == "gnu")
format = ReportFormat::Gnu;
else if (reportFormatter == "prettier")
format = ReportFormat::Prettier;

#if !defined(LUAU_ENABLE_TIME_TRACE)
if (FFlag::DebugLuauTimeTracing)
Expand Down
Loading
Loading