-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c40b115
commit c64fb9a
Showing
11 changed files
with
96 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*.lua] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
quote_style = single | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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
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
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
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,40 +1,39 @@ | ||
-- Match 2 or more uppercase letters followed by a '-' and 1 or more digits. | ||
local ISSUE_PATTERN = '%u[%u%d]+-%d+' | ||
|
||
local function enabled() | ||
-- Match 2 or more uppercase letters followed by a '-' and 1 or more digits. | ||
return vim.fn.expand('<cWORD>'):match(ISSUE_PATTERN) ~= nil | ||
return vim.fn.expand('<cWORD>'):match(ISSUE_PATTERN) ~= nil | ||
end | ||
|
||
--- @param opts Hover.Options | ||
--- @param done fun(result?: Hover.Result) | ||
local function execute(opts, done) | ||
local query = vim.fn.expand('<cWORD>'):match(ISSUE_PATTERN) | ||
|
||
local job = require('hover.async.job').job | ||
|
||
job({'jira', 'issue', 'view', query, '--plain'}, function(result) | ||
if result == nil then | ||
done() | ||
return | ||
end | ||
|
||
local lines = {} | ||
for line in result:gmatch('[^\r\n]+') do | ||
-- Remove lines starting with \27, which is not formatted well and | ||
-- is only there for help/context/suggestion lines anyway. | ||
if line:find('^\27') == nil then | ||
table.insert(lines, line) | ||
end | ||
end | ||
|
||
done {lines = lines, filetype = 'markdown'} | ||
end) | ||
local query = vim.fn.expand('<cWORD>'):match(ISSUE_PATTERN) | ||
|
||
local job = require('hover.async.job').job | ||
|
||
job({ 'jira', 'issue', 'view', query, '--plain' }, function(result) | ||
if result == nil then | ||
done() | ||
return | ||
end | ||
|
||
local lines = {} | ||
for line in result:gmatch('[^\r\n]+') do | ||
-- Remove lines starting with \27, which is not formatted well and | ||
-- is only there for help/context/suggestion lines anyway. | ||
if line:find('^\27') == nil then | ||
table.insert(lines, line) | ||
end | ||
end | ||
|
||
done { lines = lines, filetype = 'markdown' } | ||
end) | ||
end | ||
|
||
require('hover').register { | ||
name = 'Jira', | ||
priority = 175, | ||
enabled = enabled, | ||
execute = execute | ||
name = 'Jira', | ||
priority = 175, | ||
enabled = enabled, | ||
execute = execute | ||
} | ||
|
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
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