Skip to content

Commit 933d689

Browse files
committed
chore: use unix line endings in all files
1 parent cdda73d commit 933d689

File tree

3 files changed

+112
-112
lines changed

3 files changed

+112
-112
lines changed

ftplugin/ps1.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require("powershell.command").create()
1+
require("powershell.command").create()

lua/powershell/config.lua

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
local api = vim.api
2-
local fs = vim.fs
3-
local base_handlers = require "powershell.handlers"
4-
local base_commands = require "powershell.commands"
5-
6-
local M = {}
7-
8-
---@type powershell.config
9-
M.default_config = {
10-
capabilities = vim.lsp.protocol.make_client_capabilities(),
11-
bundle_path = "",
12-
init_options = vim.empty_dict() --[[@as table]],
13-
settings = vim.empty_dict() --[[@as table]],
14-
shell = "pwsh",
15-
handlers = base_handlers,
16-
commands = base_commands,
17-
root_dir = function(buf)
18-
local current_file_dir = fs.dirname(api.nvim_buf_get_name(buf))
19-
return fs.dirname(fs.find({ ".git" }, { upward = true, path = current_file_dir })[1]) or current_file_dir
20-
end,
21-
}
22-
23-
---@type powershell.config
24-
M.config = nil
25-
26-
return M
1+
local api = vim.api
2+
local fs = vim.fs
3+
local base_handlers = require "powershell.handlers"
4+
local base_commands = require "powershell.commands"
5+
6+
local M = {}
7+
8+
---@type powershell.config
9+
M.default_config = {
10+
capabilities = vim.lsp.protocol.make_client_capabilities(),
11+
bundle_path = "",
12+
init_options = vim.empty_dict() --[[@as table]],
13+
settings = vim.empty_dict() --[[@as table]],
14+
shell = "pwsh",
15+
handlers = base_handlers,
16+
commands = base_commands,
17+
root_dir = function(buf)
18+
local current_file_dir = fs.dirname(api.nvim_buf_get_name(buf))
19+
return fs.dirname(fs.find({ ".git" }, { upward = true, path = current_file_dir })[1]) or current_file_dir
20+
end,
21+
}
22+
23+
---@type powershell.config
24+
M.config = nil
25+
26+
return M

lua/powershell/dap.lua

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
1-
local api = vim.api
2-
local util = require "powershell.util"
3-
4-
local M = {}
5-
6-
-- TODO: modify to allow multiple different seession_files
7-
local temp_path = vim.fn.stdpath "cache"
8-
local session_file_path = ("%s/powershell_es.temp_session.json"):format(temp_path)
9-
session_file_path = vim.fs.normalize(session_file_path)
10-
local log_file_path = ("%s/powershell_es.temp.log"):format(temp_path)
11-
log_file_path = vim.fs.normalize(log_file_path)
12-
vim.fn.delete(session_file_path)
13-
14-
---@param bundle_path string
15-
---@return string[]
16-
local function make_cmd(bundle_path, shell)
17-
local file = ("%s/PowerShellEditorServices/Start-EditorServices.ps1"):format(bundle_path)
18-
file = vim.fs.normalize(file)
19-
--stylua: ignore
20-
return {
21-
shell,
22-
"-NoLogo",
23-
"-NoProfile",
24-
"-NonInteractive",
25-
"-File", file,
26-
"-HostName", "nvim",
27-
"-HostProfileId", "Neovim",
28-
"-HostVersion", "1.0.0",
29-
"-LogPath", log_file_path,
30-
-- TODO: make this configurable
31-
"-LogLevel", "Normal",
32-
"-BundledModulesPath", ("%s"):format(bundle_path),
33-
"-DebugServiceOnly",
34-
-- TODO: wait for response on https://github.com/PowerShell/PowerShellEditorServices/issues/2164
35-
-- "-EnableConsoleRepl",
36-
"-SessionDetailsPath", session_file_path,
37-
}
38-
end
39-
40-
function M.setup()
41-
local dap = require "dap"
42-
local config = require("powershell.config").config
43-
44-
dap.adapters.ps1 = function(on_config)
45-
local cmd = make_cmd(config.bundle_path, config.shell)
46-
vim.system(cmd)
47-
util.wait_for_session_file(session_file_path, function(current_session_details, error_msg)
48-
if error_msg then return vim.notify(error_msg, vim.log.levels.ERROR) end
49-
50-
on_config {
51-
type = "pipe",
52-
pipe = current_session_details.debugServicePipeName,
53-
}
54-
end)
55-
end
56-
dap.configurations.ps1 = {
57-
{
58-
name = "PowerShell: Launch Current File",
59-
type = "ps1",
60-
request = "launch",
61-
script = "${file}",
62-
},
63-
{
64-
name = "PowerShell: Launch Script",
65-
type = "ps1",
66-
request = "launch",
67-
script = function()
68-
return coroutine.create(function(co)
69-
vim.ui.input({
70-
prompt = 'Enter path or command to execute, for example: "${workspaceFolder}/src/foo.ps1" or "Invoke-Pester"',
71-
completion = "file",
72-
}, function(selected) coroutine.resume(co, selected) end)
73-
end)
74-
end,
75-
},
76-
{
77-
name = "PowerShell: Attach to PowerShell Host Process",
78-
type = "ps1",
79-
request = "attach",
80-
processId = "${command:pickProcess}",
81-
},
82-
}
83-
end
84-
85-
return M
1+
local api = vim.api
2+
local util = require "powershell.util"
3+
4+
local M = {}
5+
6+
-- TODO: modify to allow multiple different seession_files
7+
local temp_path = vim.fn.stdpath "cache"
8+
local session_file_path = ("%s/powershell_es.temp_session.json"):format(temp_path)
9+
session_file_path = vim.fs.normalize(session_file_path)
10+
local log_file_path = ("%s/powershell_es.temp.log"):format(temp_path)
11+
log_file_path = vim.fs.normalize(log_file_path)
12+
vim.fn.delete(session_file_path)
13+
14+
---@param bundle_path string
15+
---@return string[]
16+
local function make_cmd(bundle_path, shell)
17+
local file = ("%s/PowerShellEditorServices/Start-EditorServices.ps1"):format(bundle_path)
18+
file = vim.fs.normalize(file)
19+
--stylua: ignore
20+
return {
21+
shell,
22+
"-NoLogo",
23+
"-NoProfile",
24+
"-NonInteractive",
25+
"-File", file,
26+
"-HostName", "nvim",
27+
"-HostProfileId", "Neovim",
28+
"-HostVersion", "1.0.0",
29+
"-LogPath", log_file_path,
30+
-- TODO: make this configurable
31+
"-LogLevel", "Normal",
32+
"-BundledModulesPath", ("%s"):format(bundle_path),
33+
"-DebugServiceOnly",
34+
-- TODO: wait for response on https://github.com/PowerShell/PowerShellEditorServices/issues/2164
35+
-- "-EnableConsoleRepl",
36+
"-SessionDetailsPath", session_file_path,
37+
}
38+
end
39+
40+
function M.setup()
41+
local dap = require "dap"
42+
local config = require("powershell.config").config
43+
44+
dap.adapters.ps1 = function(on_config)
45+
local cmd = make_cmd(config.bundle_path, config.shell)
46+
vim.system(cmd)
47+
util.wait_for_session_file(session_file_path, function(current_session_details, error_msg)
48+
if error_msg then return vim.notify(error_msg, vim.log.levels.ERROR) end
49+
50+
on_config {
51+
type = "pipe",
52+
pipe = current_session_details.debugServicePipeName,
53+
}
54+
end)
55+
end
56+
dap.configurations.ps1 = {
57+
{
58+
name = "PowerShell: Launch Current File",
59+
type = "ps1",
60+
request = "launch",
61+
script = "${file}",
62+
},
63+
{
64+
name = "PowerShell: Launch Script",
65+
type = "ps1",
66+
request = "launch",
67+
script = function()
68+
return coroutine.create(function(co)
69+
vim.ui.input({
70+
prompt = 'Enter path or command to execute, for example: "${workspaceFolder}/src/foo.ps1" or "Invoke-Pester"',
71+
completion = "file",
72+
}, function(selected) coroutine.resume(co, selected) end)
73+
end)
74+
end,
75+
},
76+
{
77+
name = "PowerShell: Attach to PowerShell Host Process",
78+
type = "ps1",
79+
request = "attach",
80+
processId = "${command:pickProcess}",
81+
},
82+
}
83+
end
84+
85+
return M

0 commit comments

Comments
 (0)