diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index df77c78b3e..e5dfbb1a9e 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -26,7 +26,7 @@ jobs: - name: Create backport PR id: backport - uses: korthout/backport-action@4aaf0e03a94ff0a619c9a511b61aeb42adea5b02 # v4.2.0 + uses: korthout/backport-action@7c3f6cd5843cac11bc59a04a1b7699af93261670 # v4.5.0 with: pull_title: "backport: ${pull_title}" label_pattern: "^ci:backport ([^ ]+)$" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b7a028002a..8b3450381f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -31,11 +31,11 @@ jobs: - uses: ./.github/actions/setup - name: Initialize CodeQL - uses: github/codeql-action/init@v4.35.1 + uses: github/codeql-action/init@v4.35.2 with: languages: cpp - run: make - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4.35.1 + uses: github/codeql-action/analyze@v4.35.2 diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index 8f84b804b5..a2f5ecfebc 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -21,4 +21,4 @@ jobs: persist-credentials: false - name: Run zizmor - uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2 + uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3 diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 9cf56cd077..3309dec1a7 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -661,9 +661,9 @@ Lua module: vim.diagnostic *diagnostic-api* |diagnostic-severity| • {text}? (`table`) A table mapping |diagnostic-severity| to the sign text to display in the - sign column. The default is to use `"E"`, `"W"`, `"I"`, - and `"H"` for errors, warnings, information, and hints, - respectively. Example: >lua + sign column and statusline. The default is to use `"E"`, + `"W"`, `"I"`, and `"H"` for errors, warnings, + information, and hints, respectively. Example: >lua vim.diagnostic.config({ signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } }) diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 494757742a..63e705fd70 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -158,6 +158,8 @@ DIAGNOSTICS enabled or disabled diagnostics. • |vim.diagnostic.status()| returns a status description of current buffer diagnostics. + • It uses the severity names defined by the `signs` field of + |vim.diagnostic.config()|, if any. • |vim.diagnostic.fromqflist()| accepts `opts.merge_lines` to merge multiline compiler messages. diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 3d2fb1f566..4696509def 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -313,8 +313,8 @@ end --- @field priority? integer --- --- A table mapping |diagnostic-severity| to the sign text to display in the ---- sign column. The default is to use `"E"`, `"W"`, `"I"`, and `"H"` for errors, ---- warnings, information, and hints, respectively. Example: +--- sign column and statusline. The default is to use `"E"`, `"W"`, `"I"`, and `"H"` +--- for errors, warnings, information, and hints, respectively. Example: --- ```lua --- vim.diagnostic.config({ --- signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } } @@ -3028,20 +3028,26 @@ function M.status(bufnr) bufnr = bufnr or 0 local config = assert(M.config()).status or {} vim.validate('config.format', config.format, { 'table', 'function' }, true) + local counts = M.count(bufnr) - local format = config.format or default_status_signs - --- @type string - local result_str - if type(format) == 'table' then - local signs = vim.tbl_extend('keep', format, default_status_signs) + local format = config.format + local result_str --- @type string + if type(format) == 'function' then + result_str = format(counts) + else + local signs ---@type table + if type(format) == 'table' then + signs = format + else + local signs_config = assert(vim.diagnostic.config()).signs + signs = type(signs_config) == 'table' and signs_config.text or default_status_signs + end result_str = vim .iter(pairs(counts)) :map(function(severity, count) return ('%%#%s#%s:%s'):format(hl_map[severity], signs[severity], count) end) :join(' ') - elseif type(format) == 'function' then - result_str = format(counts) end if result_str:len() > 0 then result_str = result_str .. '%##'