luozhiya / fittencode.nvim

Fitten Code AI Programming Assistant for Neovim
84 stars 9 forks source link

lua 语言补全 会自动添加 \ #24

Closed cxwx closed 5 months ago

cxwx commented 5 months ago
截屏2024-04-20 17 43 47

无法根据语言进行配置 Codeium 补全正常 “。。。” 但是 fittencode 会自动添加 \“ 。。。\” 补全后会多出来 '\'

luozhiya commented 5 months ago

@cxwx

能够复现吗?请设置一下 logDEBUG, 输出日志信息看看

log = {
  level = vim.log.levels.DEBUG,
},
cxwx commented 5 months ago
================================================================================
Verbose logging started: 2024-04-21 14:13:28
Log level: DEBUG
Calling process: /opt/homebrew/Cellar/neovim/0.9.5/bin/nvim
Neovim version: {
  buildtype = "Release",
  luajit = "2.1.1710088188",
  nvim = "v0.9.5"
}
Process ID: 37284
Parent process ID: 37283
OS: {
  machine = "arm64",
  release = "23.4.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000"
}
================================================================================
[ INFO] [2024-04-21 14:13:28.429] [fittencode.nvim] Loading last session
[DEBUG] [2024-04-21 14:13:28.429] [fittencode.nvim] Loading key file: "/Users/**/.local/share/nvim/fittencode/api_key.json"
[DEBUG] [2024-04-21 14:13:29.521] [fittencode.nvim] Key file loaded successful
[ INFO] [2024-04-21 14:13:29.523] [fittencode.nvim] Last session for user "**@gmail.com" loaded successful
================================================================================
Verbose logging started: 2024-04-21 14:13:34
Log level: DEBUG
Calling process: /opt/homebrew/Cellar/neovim/0.9.5/bin/nvim
Neovim version: {
  buildtype = "Release",
  luajit = "2.1.1710088188",
  nvim = "v0.9.5"
}
Process ID: 37481
Parent process ID: 37480
OS: {
  machine = "arm64",
  release = "23.4.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000"
}
================================================================================
[ INFO] [2024-04-21 14:13:34.925] [fittencode.nvim] Loading last session
[DEBUG] [2024-04-21 14:13:34.926] [fittencode.nvim] Loading key file: "/Users/**/.local/share/nvim/fittencode/api_key.json"
[DEBUG] [2024-04-21 14:13:34.987] [fittencode.nvim] Key file loaded successful
[ INFO] [2024-04-21 14:13:34.991] [fittencode.nvim] Last session for user "**@gmail.com" loaded successful
================================================================================
Verbose logging started: 2024-04-21 14:13:39
Log level: DEBUG
Calling process: /opt/homebrew/Cellar/neovim/0.9.5/bin/nvim
Neovim version: {
  buildtype = "Release",
  luajit = "2.1.1710088188",
  nvim = "v0.9.5"
}
Process ID: 37637
Parent process ID: 37636
OS: {
  machine = "arm64",
  release = "23.4.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000"
}
================================================================================
[ INFO] [2024-04-21 14:13:39.941] [fittencode.nvim] Loading last session
[DEBUG] [2024-04-21 14:13:39.941] [fittencode.nvim] Loading key file: "/Users/**/.local/share/nvim/fittencode/api_key.json"
[DEBUG] [2024-04-21 14:13:39.008] [fittencode.nvim] Key file loaded successful
[ INFO] [2024-04-21 14:13:39.012] [fittencode.nvim] Last session for user "**@gmail.com" loaded successful
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Start generate one stage...
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Requested row: 31, col: 6
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Cached row: nil, col: nil
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Cached cursor is outdated
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] New task created; task_id: 1.0360280906858e+15, row: 31, col: 6
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Request generate one stage...
[DEBUG] [2024-04-21 14:13:41.090] [fittencode.nvim] Inline mode is disabled; col: 6, line: "      ", length of line: 6
[DEBUG] [2024-04-21 14:13:42.024] [fittencode.nvim] RESTAPI uv.spawn exit; code: 0
[DEBUG] [2024-04-21 14:13:42.024] [fittencode.nvim] Task matched; time elapsed: [ "934" ms ], task_id: 1.0360280906858e+15, row: 31, col: 6
[DEBUG] [2024-04-21 14:13:42.025] [fittencode.nvim] Suggestions received; task_id: 1.0360280906858e+15, suggestions: { '\\"ToggleToc\\",' }
[DEBUG] [2024-04-21 14:13:42.029] [fittencode.nvim] Processed suggestions: { '"ToggleToc",' }
[DEBUG] [2024-04-21 14:13:42.032] [fittencode.nvim] Source request: {
  completion_context = {
    triggerKind = 1
  },
  context = {
    aborted = true,
    bufnr = 1,
    cache = {
      entries = {
        ["get_offset:\\%(-\\?\\d\\+\\%(\\.\\d\\+\\)\\?\\|\\h\\w*\\%(-\\w*\\)*\\):      "] = 7
      },
      <metatable> = {
        __index = {
          clear = <function 1>,
          ensure = <function 2>,
          get = <function 3>,
          key = <function 4>,
          new = <function 5>,
          set = <function 6>
        }
      }
    },
    cursor = {
      character = 6,
      col = 7,
      line = 31,
      row = 32
    },
    cursor_after_line = "",
    cursor_before_line = "      ",
    cursor_line = "      ",
    filetype = "lua",
    id = 38,
    option = {
      reason = "manual"
    },
    prev_context = {
      aborted = true,
      bufnr = 1,
      cursor = {
        character = 6,
        col = 7,
        line = 31,
        row = 32
      },
      cursor_after_line = "",
      cursor_before_line = "      ",
      cursor_line = "      ",
      filetype = "lua",
      id = 37,
      option = {},
      time = 1036027011
    },
    time = 1036028009,
    <metatable> = {
      __index = {
        abort = <function 7>,
        changed = <function 8>,
        clone = <function 9>,
        empty = <function 10>,
        get_offset = <function 11>,
        get_reason = <function 12>,
        new = <function 13>
      }
    }
  },
  group_index = 1,
  name = "fittencode",
  offset = 7,
  option = {}
}
[DEBUG] [2024-04-21 14:13:42.033] [fittencode.nvim] LSP CompletionResponse: {
  isIncomplete = false,
  items = { {
      documentation = {
        kind = "markdown",
        value = '```lua\n\\"ToggleToc\\",\n```'
      },
      insertTextMode = 1,
      label = '\\"ToggleToc\\",',
      textEdit = {
        newText = '\\"ToggleToc\\",',
        range = {
          ["end"] = {
            character = 6,
            line = 31
          },
          start = {
            character = 6,
            line = 31
          }
        }
      },
      word = '\\"ToggleToc\\",'
    } }
}
[DEBUG] [2024-04-21 14:13:42.033] [fittencode.nvim] Clearing HTTP temporary file: "/var/folders/05/dfw4d4ds0nx2xyyn7yt5ky3r0000gn/T/nvim.**/eSRp6j/7"
[DEBUG] [2024-04-21 14:13:42.034] [fittencode.nvim] HTTP temporary file deleted successfully

似乎补全出来的就是带 \ 的

luozhiya commented 5 months ago

@cxwx

您试一下最新的 commit,看是否修复了问题

cxwx commented 5 months ago

Fixed,感谢

cxwx commented 5 months ago

请问修改的是哪个commit?

luozhiya commented 5 months ago

@cxwx

在这里 https://github.com/luozhiya/fittencode.nvim/commit/066f0261ccd848d21595135845b319431b7b3d07 source 模式下也使用预处理了的补全