Skip to content

Code completion crashed #1978

Closed
Closed
@chrisniael

Description

@chrisniael

Which OS are you using?

Windows

Expected Behaviour

When typing for, VSCode would popup completion list like this:

image

Actual Behaviour

There are no popups and there are an error notification.

image

image

Reproduction steps

  1. Config VSCode

    • Text Editor - Files: Associations

      Item Value
      *.bytes lua
    • Extensions - Lua > Runtime: Path

      • ?.lua
      • ?/init.lua
      • Common/?.bytes
  2. Create an example project, file tree like this:

    │  main.lua
    │
    └─Common
            enum.bytes
    

    main.lua

    local a = require("enum")
    print(a)

    Common/enum.bytes

    return {
        name = "zhangsan"
    }
  3. Change something of file enum.bytes (this is very important for reproducing this bug!), for example:

    Common/enum.bytes

    return {
        name = "zhangsan",
        age = 21
    }
  4. Type for in main.lua, wait VSCode do completion.

Additional Notes

No response

Log

script\core\completion\auto-require.lua:61: attempt to index a nil value
stack traceback:
	script\core\completion\auto-require.lua:61: in function 'core.completion.auto-require.check'
	script\core\completion\completion.lua:407: in upvalue 'checkModule'
	script\core\completion\completion.lua:1457: in upvalue 'tryWord'
	script\core\completion\completion.lua:2231: in upvalue 'tryCompletions'
	script\core\completion\completion.lua:2247: in function 'core.completion.completion.completion'
	script\provider\provider.lua:622: in function <script\provider\provider.lua:597>
	[C]: in function 'xpcall'
	script\proto\proto.lua:191: in function <script\proto\proto.lua:166>
[Error - 2:10:13 PM] Request textDocument/completion failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions