dapetcu21 / atom-autocomplete-lua

Extensible autocomplete+ provider for Lua
35 stars 6 forks source link

Object.dirname is deprecated. #11

Closed macjabeth closed 7 years ago

macjabeth commented 7 years ago

Argument to path.dirname must be a string

Object.dirname (/opt/atom/resources/app.asar/src/electron-shims.js:9:10)
_loop (/home/bunster/.atom/packages/autocomplete-lua/lib/options/luacompleterc.js:57:41)
undefined.next (null:null:null)
LuaCompleteRcProvider.<anonymous> (/home/bunster/.atom/packages/autocomplete-lua/lib/options/luacompleterc.js:86:27)
undefined.next (null:null:null)
step (/home/bunster/.atom/packages/autocomplete-lua/lib/options/luacompleterc.js:7:273)
dapetcu21 commented 7 years ago

Huh? Which one is it? Deprecated warning or argument must be a string? Also, what's your Atom version, plugin version and OS?

macjabeth commented 7 years ago

Atom Version: 1.14.2 Plugin Version: 0.8.0 OS: Linux (Ubuntu)

Not sure what the error was, it just showed up at the bottom and I clicked on the button to create an issue on here for it.

The deprecation error isn't showing up at the bottom anymore, though.

EDIT: Scratch that, it is showing up again.

image

THE-FYP commented 7 years ago

same. appears after typing anything in editor with lua syntax.

DanyGagnoon commented 7 years ago

same

pablomayobre commented 7 years ago

This happens on new unsaved files, which haven't got a path associated to them so path.dirname gets undefined or null which of course aren't strings

pablomayobre commented 7 years ago

To expand. The problem is in line 38 of luacompleterc.js, in that line path.dirname is called with filePath as argument, which is defined above in line 33 as editor.getBuffer().getPath() which can return null on unsaved files.

I think that the LuaCompleteRcProvider should return the previousOptions if filePath is null as done here