seflless / atom-diagrams

Create Dot and Network Sequence diagrams in the Atom IDE.

Home Page:https://atom.io/packages/diagrams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object.extname is deprecated.

michaeloboyle opened this issue · comments

Argument to path.extname must be a string

Object.extname (/Applications/Atom.app/Contents/Resources/app.asar/src/electron-shims.js:20:10)
setupPreviewer (/Users/moboyle/.atom/packages/diagrams/lib/diagrams.js:58:35)
textEditorObserverDisposable.atom.workspace.observeTextEditors (/Users/moboyle/.atom/packages/diagrams/lib/diagrams.js:36:13)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:334:16)
Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28)

Where do I use path.extname with a parameter that isn't a string? There are only two instances of it in the code base [1]:

  • uriToOpen[2] is a string.
  • editor.getPath() [3]

diagrams.js:58:35 is where the error occurred. I wonder if "editor.getPath()" had a problem and returned something other than the path as string.

The same issue.

Object.extname - /usr/share/atom/resources/app.asar/src/electron-shims.js:20:10
setupPreviewer - /home/leon/.atom/packages/diagrams/lib/diagrams.js:58:35
textEditorObserverDisposable.atom.workspace.observeTextEditors - /home/leon/.atom/packages/diagrams/lib/diagrams.js:36:13
- /usr/share/atom/resources/app.asar/src/workspace.js:334:16
Function.module.exports.Emitter.simpleDispatch - /usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14
Emitter.emit - /usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:129:28

@leino11121 Could I get a link to a repo, or a .zip of the project this occurring in? I'd love to see if I can reproduce it, I don't have any issues every time I try from a fresh install.

Are you on Linux?

Seeing the issue on OSX.

What are the steps you went through to hit this?

It's a deprecation that Atom flags in the status bar, nothing while actually using the package.

I'm closing this as I couldn't repro. Please re-open if you see this issue still.

I see this on Atom 1.19.4. I installed the package via Prefrences/Install, searching for diagrams. After installation was complete I saw the yellow warning on bottom right of the window with title 1 deprecation.

Can you take a screen shot of the deprecation page with all of the deprecation details showing, please? Would be much appreciated.

For the life of me I can't figure this one out. Do you mind modifying diagrams/lib/diagrams.js around 106 to console log the type of editor.getPath(), as it should always be a string. This makes no sense.

I think this happens when there is only the untitled editor (an empty fresh editor) on start. For such editor, editor.getPath() is undefined.

TextEditor.getPath() returns the path of buffer. TextBuffer.getPath() I think returns the path of the file associated to it. In the case of untitled editor that file does not exist.

So to reproduce it, I think if you configure your Atom editor to "Open Empty Editor On Start, so that no previous state is restored you should see the deprecation warning.

I hope this makes sense.

Ah. Good find. I did a quick fix to get rid of the deprecation error. But this makes me realize I could be more clever about files and extensions. If a new file is saved with a diagrams supported extension, it should trigger turning on the syntax highlighting and previewer. I can't be bothered at the moment. People just have to reload the file after making it a diagrams extension.