emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: typescript from org src buffer -- tide, lsp


From: Tim Cross
Subject: Re: typescript from org src buffer -- tide, lsp
Date: Sat, 06 Nov 2021 21:33:48 +1100
User-agent: mu4e 1.7.4; emacs 28.0.60

Greg Minshall <minshall@umich.edu> writes:

> hi.
>
> i'm wondering if anyone programming in typescript might have run into,
> and solved, this "problem", of tangling into a subdirectory, and tide
> [1] not being able to resolve "relative" imports.
>
> i have a file in path /a/b/foo.org.  it includes various source blocks,
> and they do things like `:tangle c/d/bar.ts`.  another source block,
> tangled into in c/d/fubar.ts, say, does something like:
> ----
> import Bar from "./bar"
> ----
>
> when i open an Org Src edit buffer from fubar.ts's source block, with
> tide mode [1] enabled, i get a complaint
> ----
> Cannot find module './bar' or its corresponding type declarations. [2307]
> ----
> tide (or, really, iiuc, tsserver) appears to be, reasonably, looking for
> /a/b/bar.ts, and not finding it.  but, i haven't been able to figure out
> how to talk tide into looking elsewhere.
>
> i've done things like add "rootDirs" to `tsconfig.json`, to no avail.  i
> haven't been able to get lsp-mode [2] to work for this scenario, either.
>
> anyway, in case anyone has done exactly that, i'm asking.
>

I've not tried to do this, but a complete shot in the dark....

according to the org manual, you can set a :dir value in the source
block header which will specify the working directory to be used i.e.
the directory where the code will be evaluated. Perhaps setting that to
the directory where the other block has tangled the output would work?

See the Environment of a code block node under the working with source
code node in the org manual for details.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]