Giter Site home page Giter Site logo

dpp-ext-toml's Introduction

dpp-ext-toml

This ext implements toml loading.

Required

denops.vim

https://github.com/vim-denops/denops.vim

dpp.vim

https://github.com/Shougo/dpp.vim

Configuration

type Toml = {
  ftplugins?: Record<string, string>;
  hooks_file?: string;
  multiple_plugins?: Plugin[] & {
    plugins: string[];
  };
  plugins?: Plugin[];
};

const [context, options] = await args.contextBuilder.get(args.denops);

const tomlPlugins = await args.dpp.extAction(
  args.denops,
  context,
  options,
  "toml",
  "load",
  {
    path: "$BASE_DIR/deinlazy.toml",
    options: {
      lazy: true,
    },
  },
) as Toml | undefined;

dpp-ext-toml's People

Contributors

shougo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

dpp-ext-toml's Issues

Unable to load toml file containing only `[ftplugins]`

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/[email protected]/types.ts";
import { Denops, fn } from "https://deno.land/x/[email protected]/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/[email protected]/dispatcher.ts:36:12)
[denops]     at async Session.#dispatch (https://deno.land/x/[email protected]/session.ts:244:22)
[denops]     at async Session.#handleRequestMessage (https://deno.land/x/[email protected]/session.ts:271:33)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.