Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(vim): make sure LSP client can find root
Opening a file in "fig/" was causing the root to be misidentified as
"fig/" because of "fig/package.json" being a root marker. This would
lead to spurious errors (eg. inability to see root tsconfig.json, which
would cause things like "target" to be misdetected).

I think we don't need the package.json at edit time (under "src/"), but
we do need it at runtime (under "lib/") so let's just move it.
  • Loading branch information
wincent committed May 15, 2020
1 parent 2120ac4 commit dfab821
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
9 changes: 8 additions & 1 deletion aspects/vim/files/.vim/after/plugin/nvim-lsp.vim
Expand Up @@ -4,7 +4,14 @@ endif

lua << END
require'nvim_lsp'.ocamlls.setup{}
require'nvim_lsp'.tsserver.setup{}
require'nvim_lsp'.tsserver.setup{
-- cmd = {
-- "typescript-language-server",
-- "--stdio",
-- "--tsserver-log-file",
-- "tslog"
-- }
}
require'nvim_lsp'.vimls.setup{}
END

Expand Down
2 changes: 1 addition & 1 deletion aspects/vim/files/.vim/pack/bundle/opt/nvim-lsp
1 change: 0 additions & 1 deletion fig/dsl/variables.ts
Expand Up @@ -8,7 +8,6 @@ import getAspectFromCaller from '../getAspectFromCaller.js';
* and stored in JSON).
*/
export default function variables(callback: (v: Variables) => Variables) {
// BUG: "Cannot find name 'Variables'" from here in Vim LSP
const caller = getCaller();

const aspect = getAspectFromCaller(caller);
Expand Down
8 changes: 0 additions & 8 deletions fig/package.json

This file was deleted.

11 changes: 10 additions & 1 deletion install
Expand Up @@ -27,7 +27,16 @@ tsc

# Hacks so that built JS can import from 'fig':
ln -fns ../lib/fig node_modules/fig
cp fig/package.json lib/fig/package.json
cat > lib/fig/package.json <<HERE
{
"name": "fig",
"description": "An absurd configuration framework",
"version": "0.0.1",
"main": "index.js",
"private": true,
"type": "module"
}
HERE

log_info "Running main"

Expand Down

0 comments on commit dfab821

Please sign in to comment.