Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
run: |
lx --nvim test

# TODO: Not stable in Lux yet.
# For now, we use Nix for type checking
# - name: Type checks
# run: |
# lx --nvim check
- name: Type checks
run: |
lx --nvim check --warnings-as-errors
env:
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim-version }}/share/nvim/runtime

16 changes: 15 additions & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
{
"diagnostics": {
"enable": true,
"disable": [
"annotation-usage-error"
]
},
"runtime": {
"version": "Lua 5.1"
},
"workspace": {
"library": [
"$VIMRUNTIME",
".lux/5.1/test_dependencies/5.1/01a3c364614bddff7370223a5a9c4580f8e62d144384148444c518ec5367a59b-mediator_lua@1.1.2-0/src",
".lux/5.1/test_dependencies/5.1/287e827f4a088d41bba04af5f61a13614346c16fe8150eb7c4246e67d6fd163e-lua-term@0.8-1/src",
".lux/5.1/test_dependencies/5.1/316ac0b30e04e86a253d64886f3b110bd0508267474e6b58a3b973bd6857dbf4-penlight@1.14.0-3/src",
".lux/5.1/test_dependencies/5.1/36c63cd0c043eb0fbc7d5ecd75907926b7136414cef7703dcd5784a61e6a728e-nvim-dap@0.10.0-1/src",
".lux/5.1/test_dependencies/5.1/455cd98d50c6191a9685cffcda4ce783efbb957934625e134c39f43bd5df6818-luassert@1.9.0-1/src",
".lux/5.1/test_dependencies/5.1/47b12edcdc032232157ace97bddf34bddd17f6f458095885e62bbd602ad9e9ec-luasystem@0.6.3-1/src",
".lux/5.1/test_dependencies/5.1/4e9592a499c9ced4f8ce366db9db7d9c0dd1424ea8d4c8c16c1550ea3a61a696-say@1.4.1-3/src",
".lux/5.1/test_dependencies/5.1/56b98be57b1a97b869fd8ded0d2c0b9ce0b6b052e2d5abf84d060748617b2c90-busted@2.2.0-1/src",
".lux/5.1/test_dependencies/5.1/6ce29c2c535c40246c386c056f24689344cddb56ec397473931431e6b67694d2-say@1.4.1-3/src",
".lux/5.1/test_dependencies/5.1/832fd9862ce671c0c9777855d4c8b19f9ad9c2679fb5466c3a183785a51b76b0-luafilesystem@1.8.0-1/src",
".lux/5.1/test_dependencies/5.1/a6c5176043cb3de56336b7de119443dbb3d9e024be1d50e06289ad4b4959a2da-lua_cliargs@3.0.2-1/src",
".lux/5.1/test_dependencies/5.1/acdfde00d122aac481c18c906d483478bb536741beb025becc11782a075d125b-luassert@1.9.0-1/src",
".lux/5.1/test_dependencies/5.1/b54df892b93931d9062f7bb8887a2ae7e6ce116e50d9aca0cf690256d7ac05b6-neotest@5.13.1-1/src",
".lux/5.1/test_dependencies/5.1/d85464dc58c62460a1ecb14e6ac773ae615a66a8224b26ceb25d954c6b05ca74-nlua@0.3.2-1/src",
".lux/5.1/test_dependencies/5.1/e4f17b9e67313bbd5e90f425672fc8998dd0bfa43335f7c57ed2de7a799e07a6-dkjson@2.8-1/src"
".lux/5.1/test_dependencies/5.1/de206edd51dbfc1bbe56869d6729cf4a6e6e70e7b2e107093c0f6520c142d79b-nvim-nio@1.10.1-1/src",
".lux/5.1/test_dependencies/5.1/e4f17b9e67313bbd5e90f425672fc8998dd0bfa43335f7c57ed2de7a799e07a6-dkjson@2.8-1/src",
".lux/5.1/test_dependencies/5.1/e6419c49ea30f1be0576a4def3982181470d4f3961a28360a17aa9396db68ff2-plenary.nvim@scm-1/src"
]
}
}
44 changes: 0 additions & 44 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 4 additions & 63 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@

neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";

gen-luarc = {
url = "github:mrcjkb/nix-gen-luarc-json";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
git-hooks.follows = "git-hooks";
};
};

vimcats = {
url = "github:mrcjkb/vimcats";
inputs = {
Expand All @@ -37,7 +28,6 @@
nixpkgs,
flake-parts,
git-hooks,
gen-luarc,
vimcats,
...
}: let
Expand Down Expand Up @@ -65,53 +55,6 @@

ci-overlay = import ./nix/ci-overlay.nix {inherit neovim-nightly;};

luarc-plugins = with pkgs.lua51Packages;
[
nvim-nio
]
++ (with pkgs.vimPlugins; [
neotest
nvim-dap
]);

luarc-nightly = pkgs.mk-luarc {
nvim = neovim-nightly;
plugins = luarc-plugins;
};

luarc-stable = pkgs.mk-luarc {
nvim = pkgs.neovim-unwrapped;
plugins = luarc-plugins;
disabled-diagnostics = [
"undefined-doc-name"
"undefined-doc-class"
"redundant-parameter"
"invisible"
];
};

type-check-nightly = git-hooks.lib.${system}.run {
src = self;
hooks = {
lua-ls = {
enable = true;
settings.configuration = luarc-nightly;
};
};
};

type-check-stable = git-hooks.lib.${system}.run {
src = self;
hooks = {
lua-ls = {
enable = true;
settings = {
configuration = luarc-stable;
};
};
};
};

pre-commit-check = git-hooks.lib.${system}.run {
src = self;
hooks = {
Expand Down Expand Up @@ -143,12 +86,15 @@
shellHook = ''
${pre-commit-check.shellHook}
'';
env = {
EMMYLUALS_CONFIG = ".luarc.json";
};
buildInputs = with git-hooks.packages.${system}; [
pkgs.lux-cli
pkgs.statix
pkgs.nixd
pkgs.emmylua-ls
alejandra
lua-language-server
stylua
editorconfig-checker
markdownlint-cli
Expand All @@ -162,7 +108,6 @@
inherit system;
overlays = [
ci-overlay
gen-luarc.overlays.default
plugin-overlay
];
};
Expand All @@ -185,10 +130,6 @@

checks = {
formatting = pre-commit-check;
inherit
type-check-stable
type-check-nightly
;
};
};
flake = {
Expand Down
7 changes: 4 additions & 3 deletions lua/rustaceanvim/cache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ store-success-output = true

---@return string path to nextest.toml file
function M.nextest_config_path()
local cache_dir = vim.fs.joinpath(vim.fn.stdpath('cache'), 'rustaceanvim')
local config_path = vim.fs.joinpath(cache_dir, 'nextest_1.toml')
local nvim_cache_dir = vim.fn.stdpath('cache') ---@as string
local rustaceanvim_cache_dir = vim.fs.joinpath(nvim_cache_dir, 'rustaceanvim')
local config_path = vim.fs.joinpath(rustaceanvim_cache_dir, 'nextest_1.toml')

-- Check if file already exists
local stat = vim.uv.fs_stat(config_path)
Expand All @@ -21,7 +22,7 @@ function M.nextest_config_path()
end

-- Create cache directory if it doesn't exist
vim.fn.mkdir(cache_dir, 'p')
vim.fn.mkdir(rustaceanvim_cache_dir, 'p')

-- Write the config file
local file = io.open(config_path, 'w')
Expand Down
9 changes: 5 additions & 4 deletions lua/rustaceanvim/cached_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ local M = {}
local cache = {
---@type rustaceanvim.RARunnableArgs | nil
last_debuggable = nil,
---@type rustaceanvim.RARunnablesChoice
---@type rustaceanvim.RARunnablesChoice | nil
last_runnable = nil,
---@type rustaceanvim.RARunnablesChoice
---@type rustaceanvim.RARunnablesChoice | nil
last_testable = nil,
}

Expand Down Expand Up @@ -54,8 +54,9 @@ end
---@param choice rustaceanvim.RARunnablesChoice
---@param executableArgsOverride? string[]
local function override_executable_args_if_set(choice, executableArgsOverride)
if type(executableArgsOverride) == 'table' and #executableArgsOverride > 0 then
choice.runnables[choice.choice].args.executableArgs = executableArgsOverride
local runnable = choice.runnables[choice.choice]
if type(executableArgsOverride) == 'table' and #executableArgsOverride > 0 and runnable then
runnable.args.executableArgs = executableArgsOverride
end
end

Expand Down
5 changes: 3 additions & 2 deletions lua/rustaceanvim/cargo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local function get_cargo_metadata(path, callback)
return callback and callback(cargo_crate_dir) or cargo_crate_dir
end
local ok, cargo_metadata_json = pcall(vim.fn.json_decode, sc.stdout)
if ok and cargo_metadata_json then
if ok and type(cargo_metadata_json) == 'table' then
return callback and callback(cargo_crate_dir, cargo_metadata_json) or cargo_crate_dir, cargo_metadata_json
else
vim.notify(
Expand Down Expand Up @@ -107,7 +107,8 @@ local function get_mb_active_client_root(file_name)
item = os.normalize_path_on_windows(item)
if file_name:sub(1, #item) == item then
local clients = rust_analyzer.get_active_rustaceanvim_clients()
return clients and #clients > 0 and clients[#clients].config.root_dir or nil
local client = clients[#clients]
return client and client.config.root_dir or nil
end
end
end
Expand Down
Loading
Loading