ananthakumaran / tide

Tide - TypeScript Interactive Development Environment for Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tide mode broken in temp buffers

elibarzilay opened this issue · comments

(Apologies if this is known, I can't look at where exactly this is coming from...)

When tide is used for a temp buffer (which means that there is no file that holds the content) I keep getting errors like the below. It's particularly bad since I'm using magit, which tends to create such buffers in many cases (ie, to show a file at a particular commit, which is not actually in the FS).

Error processing request. Cannot read property 'replace' of null
TypeError: Cannot read property 'replace' of null
    at normalizeSlashes (/home/eli/ts/ts/built/local/tsserver.js:6305:21)
    at Object.normalizePath (/home/eli/ts/ts/built/local/tsserver.js:6414:16)
    at Object.toNormalizedPath (/home/eli/ts/ts/built/local/tsserver.js:142034:23)
    at IOSession.Session.getFileAndProjectWorker (/home/eli/ts/ts/built/local/tsserver.js:149309:35)
    at IOSession.Session.getFileAndProject (/home/eli/ts/ts/built/local/tsserver.js:149293:29)
    at IOSession.Session.getQuickInfoWorker (/home/eli/ts/ts/built/local/tsserver.js:149368:31)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (/home/eli/ts/ts/built/local/tsserver.js:148365:61)
    at /home/eli/ts/ts/built/local/tsserver.js:150050:88
    at IOSession.Session.executeWithRequestId (/home/eli/ts/ts/built/local/tsserver.js:150041:28)
    at IOSession.Session.executeCommand (/home/eli/ts/ts/built/local/tsserver.js:150050:33)
    at IOSession.Session.onMessage (/home/eli/ts/ts/built/local/tsserver.js:150074:35)
    at Interface.<anonymous> (/home/eli/ts/ts/built/local/tsserver.js:151390:27)
    at Interface.emit (events.js:210:5)
    at Interface._onLine (readline.js:316:10)
    at Interface._normalWrite (readline.js:461:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:326:12)
    at readableAddChunk (_stream_readable.js:301:11)
    at Socket.Readable.push (_stream_readable.js:235:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:182:23)

yes, tide needs a buffer backed by real file. There is some support for indirect buffer like org-mode, where we send the full contents to tsserver instead of just the filename.

In magit case, it's better to not enable tide mode at all. But I can't find a reliable way to detect it's a magit buffer.

Related, but not completely (tell me if needs a separate issue), I’m struggling in getting tide to work with org-mode.

More specific when I’m working with tangled files, which I know the destination path, so I declare buffer-filename and tide-active-buffer-file-name on org-babel-edit-prep:typescript.

It seems not working also because tide-require-manual-setup remains t even if I explicit set to nil in the hook mention above.

Is there a way to get full featured tide when knowing the destination path of a tanglable (not sure that is a correct word) buffer?

Seems that this is somehow possible with lsp-mode but I didn’t give it a try.

Thanks for making tide!

@M3kH looks like a regression, I can't get it to work either. Could you open a separate issue to track this