Repository: neovim
Issue: LSP:  `:tag` behaving differently from `C-]`, `C-w ]`, `C-w }` etc with `vim.lsp.tagfunc`
Labels: bug,lsp

### Problem

I think this is a problem with `vim.lsp.tagfunc`, so I put it this category.

## Problem

Consider this minimal typescript file:
```ts
interface Iface {
}
const iface = 1;

const thing = null;
const Thing = 2;

const Other = 3;
function _() {
    const other = null;
}

function main() {
    const x = Thing;
    const y: Iface = {};
    const z = Other;
}
const x = Thing;
const y: Iface = {};
const z = Other;
```
The problem is basically that if you do `:tag` with one of the uppercase symbols, it goes to the lower case one no matter what. I have put multiple cases above to show that it happens in all kinds of situations, regardless of order of appearance, kind of symbol, etc. The most peculiar is `:tag Other` for which it goes to an out of scope variable `other` inside that other function!

This problem does not happen for these actions: `:lua vim.lsp.buf.definition()`, `C-]`, `C-w }` and `C-w ]`. So, I don't think its a language server problem. Weirdly, `:h C-]` (or any of the others) says it calls `:tag` internally.

I haven't changed any of the `*case` options at all, but here are their defaults anyway: `noignorecase nosmartcase tagcase=followic`. Just in case, I checked that this happens with `tagcase=match` as well.

Aside, another issue I noticed but I'm not sure I should make a separate issue for, is that `vim.lsp.tagfunc` doesn't seem to support `i_CTRL-X_CTRL_]`

## Reproduction

 - Checkout the latest stable(8b98642002d0506d20628683958cb5c97a0dad80) or the latest master(b34e137e43d359c8db4fb76028dea3b410842aff) (it happens on both)
   - It also happens on 80e37aa533573ef1ad96bcccc006b8d45dc963b9 fwiw
 - Save the above typescript file as `one.ts` and the below lua file as `repro.lua` in the neovim directory itself
 - `make distclean && make clean && make -j$(nproc) CMAKE_BUILD_TYPE=Release`
 - Run `VIMRUNTIME=runtime build/bin/nvim -u repro.lua one.ts`
 - Try doing `:tag Other` (or any of the other uppercase ones). It will be wrong, try doing `<C-]>` with cursor on them and see that it is correct.

Below is the repro.lua for minimal reproduction.

```lua
local pattern = 'typescript'
local cmd = {'typescript-language-server', '--stdio'}
local root_markers = { 'package.json' }
local settings = vim.empty_dict()

vim.api.nvim_create_autocmd('FileType', {
  pattern = pattern,
  callback = function(args)
    local match = vim.fs.find(root_markers, { path = args.file, upward = true })[1]
    local root_dir = match and vim.fn.fnamemodify(match, ':p:h') or nil
    vim.lsp.start({
      name = 'bugged-ls',
      cmd = cmd,
      root_dir = root_dir,
      settings = settings
    })
  end
})

-- remove effects of any user plugins in standard directories
vim.opt.runtimepath = '/etc/xdg/nvim,/usr/local/share/nvim/site,/usr/share/nvim/site,runtime,/usr/local/lib/nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/etc/xdg/nvim/after'
```

### Steps to reproduce using "nvim -u minimal_init.lua"

all given above

### Expected behavior

all given above

### Nvim version (nvim -v)

master or stable

### Language server name/version

typescript-language-server 4.3.3

### Operating system/version

Linux 6.11.3-arch1-1

### Log file

_No response_