gelio / cmp-natdat Goto Github PK
View Code? Open in Web Editor NEWnvim-cmp source to autocomplete natural dates and turm them into ISO dates
License: MIT License
nvim-cmp source to autocomplete natural dates and turm them into ISO dates
License: MIT License
Resolving the time-only completion (e.g. @7:25
) should include the current date: 2023-10-26 7:25
.
Otherwise, the @7:25
completion is useless, since it is the same as just typing the time 7:25
.
Let's refactor the way formatting is done to allow users to plug in their own formatters if they do not like the default formatting.
This would involve:
Creating a natdat.Formatter
type with methods for formatting different structs
---@class natdat.Formatter
---@field format_month fun(month: natdat.Month): string
---@field format_absolute_date fun(absolute_date: natdat.AbsoluteDate): string
---...
Creating 2 formatters:
ISOFormatter
with methods from existing format_iso
LabelFormatter
with methods from existing format_original
Replacing the format_iso
and format_original
methods on structures with a single format fun(formatter: natdat.Formatter): string
. Each such method would call a corresponding formatter
method.
Accepting a formatter
for the insertText
in the cmp_natdat
source. By default, it would be the ISOFormatter
Could you consider setting up a custom kind for this source, so that it's possible to customize its icon? Copilot cmp does it and it lets me modify the Copilot icon like so:
{
-- Vscode-like pictograms for Neovim LSP completion items.
"onsails/lspkind.nvim",
config = function()
local lspkind = require("lspkind")
lspkind.init({
symbol_map = {
-- This is an Octocat with devicons.
Copilot = "๏",
},
})
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" })
end,
lazy = true,
}
Sometimes the colon is unnecessary when resolving the time.
Let's modify the time parser to account for these situations.
Sometimes this could lead to ambiguities:
I believe we should only make the colon optional when the format expects a time, so:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.