Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load toml file containing only [ftplugins] #1

Closed
tgw314 opened this issue Oct 31, 2023 · 1 comment
Closed

Unable to load toml file containing only [ftplugins] #1

tgw314 opened this issue Oct 31, 2023 · 1 comment

Comments

@tgw314
Copy link

tgw314 commented Oct 31, 2023

Problems summary

Unable to load toml file containing only [ftplugins]

Expected

Toml files containing only [ftplugins] should load successfully without issues.

Environment Information

Provide a minimal init.vim/vimrc without plugin managers (Required!)

let s:dpp_dir = stdpath("data") . '/dpp'
let $BASE_DIR = stdpath("config")

execute 'set runtimepath+=' . s:dpp_dir . '/repos/github.com/Shougo/dpp.vim'
execute 'set runtimepath+=' . s:dpp_dir . '/repos/github.com/Shougo/dpp-ext-toml'
execute 'set runtimepath+=' . s:dpp_dir . '/repos/github.com/vim-denops/denops.vim'

autocmd User DenopsReady call dpp#make_state(s:dpp_dir, expand('$BASE_DIR/config.ts'))
import {
  BaseConfig,
  ConfigReturn,
  ContextBuilder,
  Dpp,
  Plugin,
} from "https://deno.land/x/dpp_vim@v0.0.5/types.ts";
import { Denops, fn } from "https://deno.land/x/dpp_vim@v0.0.5/deps.ts";

export class Config extends BaseConfig {
  override async config(args: {
    denops: Denops;
    contextBuilder: ContextBuilder;
    basePath: string;
    dpp: Dpp;
  }): Promise<ConfigReturn> {
    const [context, options] = await args.contextBuilder.get(args.denops);

    await args.dpp.extAction(args.denops, context, options, "toml", "load", {
      path: await fn.expand(args.denops, "$BASE_DIR/dpp_ft.toml"),
      options: { lazy: false },
    });

    return {
      plugins: [] as Plugin[],
    };
  }
}
[ftplugins]
lua = '''
  setlocal tabstop=2
  setlocal shiftwidth=0
  setlocal expandtab
'''

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Place these files in $XDG_CONFIG_HOME/nvim-dpp-toml/
  2. Run NVIM_APPNAME=nvim-dpp-toml nvim

Screenshot (if possible)

Upload the log messages by :redir and :message (if errored)

[denops] Failed to handle message 2,invoke,dispatch,dpp,makeState,/home/{username}/.local/share/nvim-dpp-toml/dpp,/home/{username}/.config/nvim-dpp-toml/config.ts,nvim TypeError: Cannot read properties of undefined (reading 'map')
[denops]     at Object.callback (file:///home/{username}/.local/share/nvim-dpp-toml/dpp/repos/github.com/Shougo/dpp-ext-toml/denops/@dpp-exts/toml.ts:41:38)
[denops]     at eventLoopTick (ext:core/01_core.js:183:11)
[denops]     at async Dpp.extAction (file:///home/{username}/.local/share/nvim-dpp-toml/dpp/repos/github.com/Shougo/dpp.vim/denops/dpp/dpp.ts:98:17)
[denops]     at async Config.config (file:///home/{username}/.config/nvim-dpp-toml/config.ts#128.640317:19:5)
[denops]     at async Object.makeState (file:///home/{username}/.local/share/nvim-dpp-toml/dpp/repos/github.com/Shougo/dpp.vim/denops/dpp/app.ts#1264.5072559999999:55:28)
[denops]     at async dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/dispatcher.ts:36:12)
[denops]     at async Session.#dispatch (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:244:22)
[denops]     at async Session.#handleRequestMessage (https://deno.land/x/messagepack_rpc@v2.0.3/session.ts:271:33)
@Shougo
Copy link
Owner

Shougo commented Nov 1, 2023

OK. Fixed.

@Shougo Shougo closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants