-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nextls): force a download (#203)
- Loading branch information
Showing
16 changed files
with
385 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
tmp | ||
node_modules | ||
nvim-test | ||
deps | ||
busted/fixtures/basic/bin | ||
busted/fixtures/basic/data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", | ||
"Lua.workspace.checkThirdParty": false | ||
} | ||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", | ||
"runtime": { | ||
"version": "LuaJIT" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
defmodule Basic do | ||
def run do | ||
Enum.map([:one, :two], &Function.identity/1) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule Basic.MixProject do | ||
use Mix.Project | ||
|
||
@version "0.1.0" | ||
|
||
def project do | ||
[ | ||
app: :basic, | ||
description: "Basic app", | ||
version: @version, | ||
elixir: "~> 1.13", | ||
elixirc_paths: elixirc_paths(Mix.env()), | ||
start_permanent: Mix.env() == :prod, | ||
deps: deps() | ||
] | ||
end | ||
|
||
# Run "mix help compile.app" to learn about applications. | ||
def application do | ||
[ | ||
extra_applications: [:logger, :crypto] | ||
] | ||
end | ||
|
||
defp elixirc_paths(:test), do: ["lib", "test/support"] | ||
defp elixirc_paths(_), do: ["lib"] | ||
|
||
# Run "mix help deps" to learn about dependencies. | ||
defp deps do | ||
[] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
local helpers = require("nvim-test.helpers") | ||
local Screen = require("nvim-test.screen") | ||
local exec_lua = helpers.exec_lua | ||
local luv = vim.loop | ||
local eq = assert.equal | ||
|
||
describe("install", function() | ||
before_each(function() | ||
helpers.clear() | ||
helpers.fn.delete("./busted/fixtures/basic/bin", "rf") | ||
helpers.fn.delete("./busted/fixtures/basic/data", "rf") | ||
helpers.fn.mkdir("./busted/fixtures/basic/data", "p") | ||
helpers.fn.mkdir("./busted/fixtures/basic/bin", "p") | ||
-- Make plugin available | ||
exec_lua([[vim.opt.rtp:append'.']]) | ||
exec_lua([[vim.opt.rtp:append'./deps/plenary.nvim/']]) | ||
end) | ||
|
||
it("installs nextls when you open an elixir file and nextls isn't downloaded", function() | ||
helpers.fn.writefile({ "" }, "./busted/fixtures/basic/data/.next-ls-force-update-v1") | ||
exec_lua([[ | ||
vim.g.next_ls_cache_dir = "./busted/fixtures/basic/bin" | ||
vim.g.next_ls_data_dir = "./busted/fixtures/basic/data" | ||
vim.g.next_ls_default_bin = "./busted/fixtures/basic/bin/nextls" | ||
require("elixir.nextls").setup({auto_update = true, cmd = "./busted/fixtures/basic/bin/nextls" }) | ||
vim.cmd.edit("./busted/fixtures/basic/lib/basic.ex") | ||
]]) | ||
|
||
eq(luv.fs_stat("./busted/fixtures/basic/bin/nextls").mode, 33523) | ||
end) | ||
|
||
it("forces an install if the flag is not set", function() | ||
helpers.fn.mkdir("./busted/fixtures/basic/bin", "p") | ||
helpers.fn.writefile({ "foobar" }, "./busted/fixtures/basic/bin/nextls") | ||
exec_lua([[ | ||
vim.g.next_ls_cache_dir = "./busted/fixtures/basic/bin" | ||
vim.g.next_ls_data_dir = "./busted/fixtures/basic/data" | ||
vim.g.next_ls_default_bin = "./busted/fixtures/basic/bin/nextls" | ||
require("elixir.nextls").setup({auto_update = true, cmd = "./busted/fixtures/basic/bin/nextls" }) | ||
vim.cmd.edit("./busted/fixtures/basic/lib/basic.ex") | ||
]]) | ||
|
||
assert.error(function() | ||
helpers.fn.readfile("./busted/fixtures/basic/bin/nextls", "b") | ||
end) | ||
eq(luv.fs_stat("./busted/fixtures/basic/bin/nextls").mode, 33523) | ||
end) | ||
|
||
it("doesnt force an install if the flag is set", function() | ||
helpers.fn.writefile({ "" }, "./busted/fixtures/basic/data/.next-ls-force-update-v1") | ||
helpers.fn.mkdir("./busted/fixtures/basic/bin", "p") | ||
helpers.fn.writefile({ "foobar" }, "./busted/fixtures/basic/bin/nextls") | ||
local screen = Screen.new() | ||
screen:attach() | ||
exec_lua([[ | ||
vim.g.next_ls_cache_dir = "./busted/fixtures/basic/bin" | ||
vim.g.next_ls_data_dir = "./busted/fixtures/basic/data" | ||
vim.g.next_ls_default_bin = "./busted/fixtures/basic/bin/nextls" | ||
require("elixir.nextls").setup({auto_update = true, cmd = "./busted/fixtures/basic/bin/nextls" }) | ||
vim.cmd.edit("./busted/fixtures/basic/lib/basic.ex") | ||
]]) | ||
|
||
helpers.feed("<cr>") | ||
-- screen:snapshot_util() | ||
eq(helpers.fn.readfile("./busted/fixtures/basic/bin/nextls", "b")[1], "foobar") | ||
screen:expect { | ||
grid = [[ | ||
^defmodule Basic do | | ||
def run do | | ||
Enum.map([:one, :two], &Function.identity/1) | | ||
end | | ||
end | | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
{1:~ }| | ||
| | ||
]], | ||
attr_ids = { | ||
[1] = { bold = true, foreground = Screen.colors.Blue1 }, | ||
}, | ||
} | ||
end) | ||
end) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
description = "Description for the project"; | ||
|
||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = inputs@{ flake-parts, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
imports = [ | ||
# To import a flake module | ||
# 1. Add foo to inputs | ||
# 2. Add foo as a parameter to the outputs function | ||
# 3. Add here: foo.flakeModule | ||
|
||
]; | ||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; | ||
perSystem = { config, self', inputs', pkgs, system, ... }: { | ||
# Per-system attributes can be defined here. The self' and inputs' | ||
# module parameters provide easy access to attributes of the same | ||
# system. | ||
|
||
# Equivalent to inputs'.nixpkgs.legacyPackages.hello; | ||
packages.default = pkgs.hello; | ||
devShells.default = pkgs.mkShell { | ||
# The Nix packages provided in the environment | ||
packages = [ | ||
pkgs.luarocks | ||
pkgs.lua5_1 | ||
pkgs.just | ||
pkgs.stylua | ||
]; | ||
}; | ||
}; | ||
flake = { | ||
# The usual flake attributes can be defined here, including system- | ||
# agnostic ones like nixosModule and system-enumerating ones, although | ||
# those are more easily expressed in perSystem. | ||
|
||
}; | ||
}; | ||
} |
Oops, something went wrong.