mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Update Luau LSP and project configurations
- Upgraded `luau-lsp` dependency to version 1.62.0 for improved features and bug fixes. - Modified sourcemap generator command in VSCode settings for better output handling. - Enabled `fillCallArguments` in project template settings to enhance code completion. - Added new configuration options for fragment autocomplete and quote conversion in project template settings. - Introduced a `sourcemap` flag in `SyncbackCommand` to allow optional sourcemap generation during syncback operations. These changes enhance the development experience and improve the functionality of the Luau language server integration.
This commit is contained in:
parent
4564ea242f
commit
a6341783ef
7 changed files with 67 additions and 37 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -25,7 +25,7 @@
|
||||||
"luau-lsp.completion.imports.requireStyle": "alwaysAbsolute",
|
"luau-lsp.completion.imports.requireStyle": "alwaysAbsolute",
|
||||||
"luau-lsp.completion.fillCallArguments": false,
|
"luau-lsp.completion.fillCallArguments": false,
|
||||||
"luau-lsp.completion.showDeprecatedItems": false,
|
"luau-lsp.completion.showDeprecatedItems": false,
|
||||||
"luau-lsp.sourcemap.generatorCommand": "atlas",
|
"luau-lsp.sourcemap.generatorCommand": "atlas sourcemap default.project.json --output sourcemap.json --include-non-scripts --watch",
|
||||||
"luau-lsp.fflags.enableNewSolver": false,
|
"luau-lsp.fflags.enableNewSolver": false,
|
||||||
"luau-lsp.index.maxFiles": 100000,
|
"luau-lsp.index.maxFiles": 100000,
|
||||||
"luau-lsp.plugin.port": 3668,
|
"luau-lsp.plugin.port": 3668,
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,20 @@
|
||||||
"luau-lsp.sourcemap.includeNonScripts": true,
|
"luau-lsp.sourcemap.includeNonScripts": true,
|
||||||
"luau-lsp.diagnostics.strictDatamodelTypes": true,
|
"luau-lsp.diagnostics.strictDatamodelTypes": true,
|
||||||
"luau-lsp.completion.imports.requireStyle": "alwaysAbsolute",
|
"luau-lsp.completion.imports.requireStyle": "alwaysAbsolute",
|
||||||
"luau-lsp.completion.fillCallArguments": false,
|
"luau-lsp.completion.fillCallArguments": true,
|
||||||
"luau-lsp.completion.showDeprecatedItems": false,
|
"luau-lsp.completion.showDeprecatedItems": false,
|
||||||
"luau-lsp.sourcemap.generatorCommand": "atlas",
|
"luau-lsp.sourcemap.generatorCommand": "atlas sourcemap default.project.json5 --output sourcemap.json --include-non-scripts --watch",
|
||||||
"luau-lsp.fflags.enableNewSolver": false,
|
"luau-lsp.fflags.enableNewSolver": false,
|
||||||
"luau-lsp.index.maxFiles": 100000,
|
"luau-lsp.index.maxFiles": 100000,
|
||||||
|
"luau-lsp.completion.enableFragmentAutocomplete": true,
|
||||||
|
"luau-lsp.format.convertQuotes": true,
|
||||||
|
"luau-lsp.server.baseLuaurc": ".luaurc",
|
||||||
|
"luau.trace.server": "off",
|
||||||
|
|
||||||
"stylua.targetReleaseVersion": "latest",
|
"stylua.targetReleaseVersion": "latest",
|
||||||
"[luau]": {
|
"[luau]": {
|
||||||
"editor.defaultFormatter": "JohnnyMorganz.stylua"
|
"editor.defaultFormatter": "JohnnyMorganz.stylua"
|
||||||
},
|
},
|
||||||
|
|
||||||
"git.ignoreLimitWarning": true
|
"git.ignoreLimitWarning": true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
selene = "Kampfkarren/selene@0.30.0"
|
selene = "Kampfkarren/selene@0.30.0"
|
||||||
stylua = "JohnnyMorganz/stylua@2.3.1"
|
stylua = "JohnnyMorganz/stylua@2.3.1"
|
||||||
luau = "luau-lang/luau@0.708"
|
luau = "luau-lang/luau@0.708"
|
||||||
luau-lsp = "JohnnyMorganz/luau-lsp@1.61.0"
|
luau-lsp = "JohnnyMorganz/luau-lsp@1.62.0"
|
||||||
run-in-roblox = "rojo-rbx/run-in-roblox@0.3.0"
|
run-in-roblox = "rojo-rbx/run-in-roblox@0.3.0"
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ impl CloneCommand {
|
||||||
dry_run: false,
|
dry_run: false,
|
||||||
interactive: false,
|
interactive: false,
|
||||||
incremental: false,
|
incremental: false,
|
||||||
|
sourcemap: false,
|
||||||
working_dir: path.clone(),
|
working_dir: path.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,10 @@ pub struct SyncbackCommand {
|
||||||
#[clap(long, short = 'n')]
|
#[clap(long, short = 'n')]
|
||||||
pub incremental: bool,
|
pub incremental: bool,
|
||||||
|
|
||||||
|
/// Generate a sourcemap.json file after syncback.
|
||||||
|
#[clap(long)]
|
||||||
|
pub sourcemap: bool,
|
||||||
|
|
||||||
/// Base directory for resolving relative paths (project, input).
|
/// Base directory for resolving relative paths (project, input).
|
||||||
/// Defaults to the current working directory.
|
/// Defaults to the current working directory.
|
||||||
#[clap(long, hide = true, default_value = ".")]
|
#[clap(long, hide = true, default_value = ".")]
|
||||||
|
|
@ -229,45 +233,53 @@ impl SyncbackCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("Writing to the file system...");
|
log::info!("Writing to the file system...");
|
||||||
let sourcemap_path = base_path.join("sourcemap.json");
|
|
||||||
|
|
||||||
// Run file writes and sourcemap generation in parallel.
|
if self.sourcemap {
|
||||||
// The sourcemap is built entirely from in-memory data (WeakDom + path map),
|
let sourcemap_path = base_path.join("sourcemap.json");
|
||||||
// so it doesn't need to wait for files to be on disk.
|
|
||||||
let (write_result, sourcemap_result) = std::thread::scope(|s| {
|
|
||||||
let write_handle = s.spawn(|| {
|
|
||||||
result
|
|
||||||
.fs_snapshot
|
|
||||||
.write_to_vfs_parallel(base_path, session_old.vfs())
|
|
||||||
});
|
|
||||||
|
|
||||||
let sourcemap_handle = s.spawn(|| {
|
// Run file writes and sourcemap generation in parallel.
|
||||||
write_sourcemap_from_syncback(
|
// The sourcemap is built entirely from in-memory data (WeakDom + path map),
|
||||||
&result.new_tree,
|
// so it doesn't need to wait for files to be on disk.
|
||||||
&result.instance_paths,
|
let (write_result, sourcemap_result) = std::thread::scope(|s| {
|
||||||
base_path,
|
let write_handle = s.spawn(|| {
|
||||||
&sourcemap_path,
|
result
|
||||||
|
.fs_snapshot
|
||||||
|
.write_to_vfs_parallel(base_path, session_old.vfs())
|
||||||
|
});
|
||||||
|
|
||||||
|
let sourcemap_handle = s.spawn(|| {
|
||||||
|
write_sourcemap_from_syncback(
|
||||||
|
&result.new_tree,
|
||||||
|
&result.instance_paths,
|
||||||
|
base_path,
|
||||||
|
&sourcemap_path,
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
(
|
||||||
|
write_handle.join().unwrap(),
|
||||||
|
sourcemap_handle.join().unwrap(),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
(
|
write_result?;
|
||||||
write_handle.join().unwrap(),
|
|
||||||
sourcemap_handle.join().unwrap(),
|
match sourcemap_result {
|
||||||
)
|
Ok(()) => log::info!("Generated sourcemap at {}", sourcemap_path.display()),
|
||||||
});
|
Err(e) => log::warn!("Could not generate sourcemap: {}", e),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result
|
||||||
|
.fs_snapshot
|
||||||
|
.write_to_vfs_parallel(base_path, session_old.vfs())?;
|
||||||
|
}
|
||||||
|
|
||||||
write_result?;
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"Finished syncback: wrote {} files/folders, removed {}.",
|
"Finished syncback: wrote {} files/folders, removed {}.",
|
||||||
result.fs_snapshot.added_paths().len(),
|
result.fs_snapshot.added_paths().len(),
|
||||||
result.fs_snapshot.removed_paths().len()
|
result.fs_snapshot.removed_paths().len()
|
||||||
);
|
);
|
||||||
|
|
||||||
match sourcemap_result {
|
|
||||||
Ok(()) => log::info!("Generated sourcemap at {}", sourcemap_path.display()),
|
|
||||||
Err(e) => log::warn!("Could not generate sourcemap: {}", e),
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh git index if in a git repository
|
// Refresh git index if in a git repository
|
||||||
refresh_git_index(base_path);
|
refresh_git_index(base_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -568,7 +568,7 @@ pub fn assert_round_trip(session: &TestServeSession, root_id: Ref) {
|
||||||
/// (e.g., rename = REMOVE + CREATE on Windows) into a single logical packet
|
/// (e.g., rename = REMOVE + CREATE on Windows) into a single logical packet
|
||||||
/// for snapshot comparison. Takes the highest message cursor and combines
|
/// for snapshot comparison. Takes the highest message cursor and combines
|
||||||
/// all added/removed/updated entries into one message.
|
/// all added/removed/updated entries into one message.
|
||||||
fn merge_socket_packets(base: &mut SocketPacket<'static>, other: SocketPacket<'static>) {
|
pub fn merge_socket_packets(base: &mut SocketPacket<'static>, other: SocketPacket<'static>) {
|
||||||
match (&mut base.body, other.body) {
|
match (&mut base.body, other.body) {
|
||||||
(SocketPacketBody::Messages(base_msgs), SocketPacketBody::Messages(other_msgs)) => {
|
(SocketPacketBody::Messages(base_msgs), SocketPacketBody::Messages(other_msgs)) => {
|
||||||
base_msgs.message_cursor = base_msgs.message_cursor.max(other_msgs.message_cursor);
|
base_msgs.message_cursor = base_msgs.message_cursor.max(other_msgs.message_cursor);
|
||||||
|
|
|
||||||
|
|
@ -853,9 +853,18 @@ fn api_write_then_filesystem_change() {
|
||||||
session.post_api_write(&write_request).unwrap();
|
session.post_api_write(&write_request).unwrap();
|
||||||
std::thread::sleep(std::time::Duration::from_millis(500));
|
std::thread::sleep(std::time::Duration::from_millis(500));
|
||||||
|
|
||||||
// Now make a filesystem change to a DIFFERENT file
|
// Drain the API write's patch message first. Subscribing at cursor 0
|
||||||
let socket_packet = session
|
// gets it immediately, which on macOS would start the settle timer
|
||||||
.recv_socket_packet(SocketPacketType::Messages, 0, || {
|
// before the filesystem event arrives (FSEvents latency > 100ms).
|
||||||
|
let api_packet = session
|
||||||
|
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
||||||
|
.unwrap();
|
||||||
|
let api_cursor = crate::rojo_test::serve_util::get_message_cursor(&api_packet);
|
||||||
|
|
||||||
|
// Now subscribe at the post-API cursor and make the filesystem change.
|
||||||
|
// The settle timer won't start until this new event actually arrives.
|
||||||
|
let fs_packet = session
|
||||||
|
.recv_socket_packet(SocketPacketType::Messages, api_cursor, || {
|
||||||
fs::write(
|
fs::write(
|
||||||
session.path().join("src/server.server.luau"),
|
session.path().join("src/server.server.luau"),
|
||||||
"-- fs change\nprint('fs')",
|
"-- fs change\nprint('fs')",
|
||||||
|
|
@ -863,9 +872,13 @@ fn api_write_then_filesystem_change() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
// Merge both packets for the combined snapshot assertion
|
||||||
|
let mut combined = api_packet;
|
||||||
|
crate::rojo_test::serve_util::merge_socket_packets(&mut combined, fs_packet);
|
||||||
assert_yaml_snapshot!(
|
assert_yaml_snapshot!(
|
||||||
"connected_api_then_fs_patch",
|
"connected_api_then_fs_patch",
|
||||||
socket_packet.intern_and_redact(&mut redactions, ())
|
combined.intern_and_redact(&mut redactions, ())
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_round_trip(&session, root_id);
|
assert_round_trip(&session, root_id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue