Skip to content

Commit

Permalink
Merge branch 'dev-deno'
Browse files Browse the repository at this point in the history
  • Loading branch information
owittek committed Apr 10, 2023
2 parents 1682851 + 2ccd558 commit eb5e150
Show file tree
Hide file tree
Showing 14 changed files with 360 additions and 213 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ jobs:
tag: stable
message: "Current stable release: ${{ steps.release.outputs.tag_name }}"
tag_exists_error: false
force_push_tag: true
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [1.4.1](https://github.com/AstroNvim/astrocommunity/compare/v1.4.0...v1.4.1) (2023-04-09)


### Bug Fixes

* **ci:** stable tag name is fixed and will always exist so force push to it on releases ([#130](https://github.com/AstroNvim/astrocommunity/issues/130)) ([a6f836f](https://github.com/AstroNvim/astrocommunity/commit/a6f836f3e14c05b3ad6fdfea8bfe125de7ba465f))

## [1.4.0](https://github.com/AstroNvim/astrocommunity/compare/v1.3.0...v1.4.0) (2023-04-08)


### Features

* **completion:** improve copilot-cmp defaults ([#129](https://github.com/AstroNvim/astrocommunity/issues/129)) ([62599e1](https://github.com/AstroNvim/astrocommunity/commit/62599e1e1cc9f508ac92e718b68b5e96099d552b))
* **editing-support:** Add text-case.nvim ([#122](https://github.com/AstroNvim/astrocommunity/issues/122)) ([78a0f36](https://github.com/AstroNvim/astrocommunity/commit/78a0f3635cb066366326d95a738b51d1cb576b1e))
* improve copilot-cmp defaults by re-enabling C-e to turn off cmp window to see hidden copilot suggestion and add C-x and C-z mappings to go to next and previous copilot suggestions ([62599e1](https://github.com/AstroNvim/astrocommunity/commit/62599e1e1cc9f508ac92e718b68b5e96099d552b))

## [1.3.0](https://github.com/AstroNvim/astrocommunity/compare/v1.2.0...v1.3.0) (2023-04-07)


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ This repository contains plugin configuration specifications, a collection of co
## 📦 Setup

Add the following to your `plugins` configuration, either in your `user/init.lua` file or in a file in `user/plugins/` folder such as `user/plugins/community.lua`
If you not sure what folders we are talking about it is recommended to read [AstroNvim Readme](https://astronvim.com/Configuration/manage_user_config).

### `user/init.lua` example

Expand Down
5 changes: 5 additions & 0 deletions lua/astrocommunity/code-runner/sniprun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sniprun

**Repository**: <https://github.com/michaelb/sniprun>

Sniprun is a code runner plugin for neovim written in Lua and Rust. It aims to provide stupidly fast partial code testing for interpreted and compiled languages. Sniprun blurs the line between standard save/run workflow, jupyter-like notebook, and REPL/interpreters.
9 changes: 9 additions & 0 deletions lua/astrocommunity/code-runner/sniprun/sniprun.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
return {
{
"michaelb/sniprun",
keys = {},
opts = {},
build = "bash ./install.sh 1",
cmd = "SnipRun",
},
}
24 changes: 8 additions & 16 deletions lua/astrocommunity/completion/copilot-lua-cmp/copilot-lua-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ return {
fallback()
end
end, { "i", "s" })
opts.mapping["<C-e>"] = cmp.mapping {
i = function(fallback)
if copilot.is_visible() then
copilot.dismiss()
elseif not cmp.abort() then
fallback()
end
end,
c = function(fallback)
if copilot.is_visible() then
copilot.dismiss()
elseif not cmp.close() then
fallback()
end
end,
}

opts.mapping["<C-x>"] = cmp.mapping(function()
if copilot.is_visible() then copilot.next() end
end)

opts.mapping["<C-z>"] = cmp.mapping(function()
if copilot.is_visible() then copilot.prev() end
end)

return opts
end,
Expand Down
8 changes: 8 additions & 0 deletions lua/astrocommunity/pack/dart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Dart Language Pack

This plugin pack does the following:

- Adds `dart` Treesitter parsers
- Adds `dartls` language server
- Adds [flutter-tools.nvim](https://github.com/akinsho/flutter-tools.nvim) for language specific tooling
- Adds [YAML language support](../yaml)
41 changes: 41 additions & 0 deletions lua/astrocommunity/pack/dart/dart.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local utils = require "astrocommunity.utils"
return {
{ import = "astrocommunity.pack.yaml" },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table or string "all".
if not opts.ensure_installed then
opts.ensure_installed = {}
elseif opts.ensure_installed == "all" then
return
end
-- Add the "dart" and "yaml" language to opts.ensure_installed.
utils.list_insert_unique(opts.ensure_installed, "dart")
end,
},
{
"akinsho/flutter-tools.nvim",
ft = { "dart" },
init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "dartls") end,
opts = {
lsp = require("astronvim.utils.lsp").config "dartls",
debugger = {
enabled = true,
},
},
dependencies = {
{ "nvim-lua/plenary.nvim" },
{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
utils.list_insert_unique(opts.ensure_installed, "dart")
end,
},
},
},
-- Add "flutter" extension to "telescope"
{ "nvim-telescope/telescope.nvim", opts = function() require("telescope").load_extension "flutter" end },
}
48 changes: 1 addition & 47 deletions lua/astrocommunity/pack/typescript-denols/denols.lua
Original file line number Diff line number Diff line change
@@ -1,47 +1 @@
local utils = require "astrocommunity.utils"

return {
{ import = "astrocommunity.pack.json" },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table or string "all".
if not opts.ensure_installed then
opts.ensure_installed = {}
elseif opts.ensure_installed == "all" then
return
end
-- Add the required file types to opts.ensure_installed.
utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
-- Add tsserver to opts.ensure_installed using vim.list_extend.
utils.list_insert_unique(opts.ensure_installed, "denols")
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
-- Add to opts.ensure_installed using table.insert.
utils.list_insert_unique(opts.ensure_installed, "js")
end,
},
{
"sigmasd/deno-nvim",
init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "denols") end,
ft = {
"typescript",
"typescriptreact",
"javascript",
"javascriptreact",
},
opts = function() return { server = require("astronvim.utils.lsp").config "denols" } end,
},
}
return require("astrocommunity.pack.typescript-tsserver-and-denols.denols").get_config()
59 changes: 59 additions & 0 deletions lua/astrocommunity/pack/typescript-tsserver-and-denols/denols.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
local utils = require "astrocommunity.utils"
local ts_config = require "astrocommunity.pack.typescript-tsserver-and-denols.ts-config"

local Deno = {
dap_config = {
{
request = "launch",
name = "(Deno) Launch current file",
type = "pwa-node",
program = "${file}",
cwd = vim.fn.getcwd(),
runtimeExecutable = "deno",
runtimeArgs = { "run", "--inspect-wait", "--allow-all" },
attachSimplePort = 9229,
},
{
request = "launch",
name = "(Deno) Launch main.ts",
type = "pwa-node",
program = "${workspaceFolder}/main.ts",
cwd = vim.fn.getcwd(),
runtimeExecutable = "deno",
runtimeArgs = { "run", "--inspect-wait", "--allow-all" },
attachSimplePort = 9229,
},
},
}

function Deno.get_base_config()
local base_config = ts_config.get_base_config "denols"

table.insert(base_config, {
"sigmasd/deno-nvim",
init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "denols") end,
ft = ts_config.filetypes,
opts = function() return { server = require("astronvim.utils.lsp").config "denols" } end,
})
return base_config
end

function Deno.get_dap_config()
local base_dap_config = ts_config.get_base_dap_config

base_dap_config.config = function()
local dap = require "dap"
for _, language in ts_config.filetypes do
dap.configurations[language] = Deno.dap_config
end
end
return base_dap_config
end

function Deno.get_config()
local base_config = Deno.get_base_config()
table.insert(base_config, Deno.get_dap_config())
return base_config
end

return Deno
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
local utils = require "astrocommunity.utils"

local filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" }

local M = {
filetypes = filetypes,
get_base_dap_config = {
"mfussenegger/nvim-dap",
ft = filetypes,
enabled = true,
dependencies = {
{
"mxsdev/nvim-dap-vscode-js",
opts = { debugger_cmd = { "js-debug-adapter" }, adapters = { "pwa-node" } },
},
{ "theHamsta/nvim-dap-virtual-text", config = true },
{ "rcarriga/nvim-dap-ui", config = true },
},
},
}

function M.get_base_config(lsp)
if lsp ~= "tsserver" and lsp ~= "denols" then error("Invalid lsp: " .. lsp) end
return {
{ import = "astrocommunity.pack.json" },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table or string "all".
if not opts.ensure_installed then
opts.ensure_installed = {}
elseif opts.ensure_installed == "all" then
return
end
-- Add the required file types to opts.ensure_installed.
utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
-- Add tsserver to opts.ensure_installed using vim.list_extend.
utils.list_insert_unique(opts.ensure_installed, lsp)
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
-- Add to opts.ensure_installed using table.insert.
utils.list_insert_unique(opts.ensure_installed, "js")
end,
},
}
end

return M
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
return {
{ import = "astrocommunity.pack.typescript-tsserver" },
{ import = "astrocommunity.pack.typescript-denols" },
local config = {
{ import = "astrocommunity.pack.typescript-tsserver-and-denols.tsserver" },
{ import = "astrocommunity.pack.typescript-tsserver-and-denols.denols" },
{
"sigmasd/deno-nvim",
opts = function(_, opts)
Expand All @@ -13,7 +13,7 @@ return {
vim.lsp.for_each_buffer_client(bufnr, function(client, client_id)
if client.name == "tsserver" then vim.lsp.stop_client(client_id, true) end
end)
-- if tsserver attached, stop it if there is a denols server attached
-- if tsserver attached, stop it if there is a denols server attached
elseif curr_client.name == "tsserver" then
for _, client in ipairs(vim.lsp.get_active_clients { bufnr = bufnr }) do
if client.name == "denols" then
Expand Down Expand Up @@ -43,7 +43,22 @@ return {
end,
})
end,
eslint_d = function()
require("null-ls").register(require("null-ls").builtins.diagnostics.eslint_d.with {
condition = function(util)
return util.root_has_file "package.json"
or util.root_has_file ".eslintrc.json"
or util.root_has_file ".eslintrc.js"
end,
})
end,
},
},
},
}

-- Only the denols dap config is being added to the config table
-- as it's being loaded after the tsserver config
table.insert(config, require("astrocommunity.pack.typescript-tsserver-and-denols.tsserver").get_dap_config())

return config
Loading

0 comments on commit eb5e150

Please sign in to comment.