小编mst*_*ing的帖子

未知功能:elm#FindRootDirectory

我收到此错误消息:Unknown function: elm#FindRootDirectory 当我在neovim中打开elm文件时.

我正在使用ElmCast/elm-vim作为插件来编写榆树代码.

我知道我可以简单地删除这个插件,但我想使用它.

另外我发现我无法使用来自ElmCast/elm-vim的任何命令:ElmFormat,例如即使在wildmenu中建议它们,但是这个插件的语法突出显示正在工作.

我通过vim-plug安装了插件:

call plug#begin('~/.vim/vim-plug-plugins')
        Plug 'elmcast/elm-vim'
call plug#end()
Run Code Online (Sandbox Code Playgroud)

我也跑了:PlugUpdate,并:PlugUpgrade多次.

neovim这样CheckHealth说:

health#deoplete#check
========================================================================
## deoplete.nvim
  - SUCCESS: has("nvim") was successful
  - SUCCESS: has("python3") was successful
  - INFO: If you're still having problems, try the following commands:
    $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    $ nvim
    $ cat /tmp/log_{PID}
    and then create an issue on github

health#nvim#check
========================================================================
## Configuration
  - SUCCESS: no issues found

## Performance
  - …
Run Code Online (Sandbox Code Playgroud)

vim vim-plugin elm neovim

6
推荐指数
1
解决办法
509
查看次数

在docker容器中安装纱线说缺少依赖性

我正在使用节点:6.7.0图像作为我的docker容器,然后按照纱线的安装指南

sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Run Code Online (Sandbox Code Playgroud)

然后我做

apt-get update && apt-get install yarn
Run Code Online (Sandbox Code Playgroud)

但此时我收到一条错误消息

yarn : Depends: nodejs (>= 4.0.0) but it is not going to be installed
Run Code Online (Sandbox Code Playgroud)

node -v在安装之前就已经回应了,它也说6.7.0

我缺少什么?

javascript node.js docker yarnpkg

5
推荐指数
1
解决办法
8664
查看次数

通过扩展搜索git存储库中的文件

我有一个像这样*.{jpg,png}的字符串,但字符串也可能只是*.scss- 实际上它是一个editorconfig.

然后我想搜索我的git存储库跟踪的这个扩展的每个文件.

我尝试了几种方法,但没有找到任何充分的解决方案.

我得到的最接近的是: git ls-tree -r master --name-only | grep -E ".*\.jpg"

但这仅适用于单个文件扩展名,而不适用于此类内容git ls-tree -r master --name-only | grep -E ".*\.{jpg,png}".

有人可以帮帮我吗?

regex git bash shell

5
推荐指数
1
解决办法
1814
查看次数

MyInterfaceOne [] |有什么区别?MyInterfaceTwo []`和`(MyInterfaceOne | MyInterfaceTwo)[]`

使用时,MyInterfaceOne[] | MyInterfaceTwo[]在代码的其他位置出现Typescript错误,这对我来说没有意义。

myInterfaces = funcWithAboveSignature()

return myInterfaces.reduce(async (acc, interfaceType) => {
    await acc;
    if (interfaceType.prop) {
      return await someAsyncFunc(interfaceType);
    } else {
      return await someOtherAsyncFunc(interfaceType);
    }
  }, Promise.resolve());
Run Code Online (Sandbox Code Playgroud)

错误提示:

Argument of type '(acc: MyInterfaceOne, raw: MyInterfaceOne) => Promise<void>' is not assignable to parameter of type '(previousValue: MyInterfaceOne, currentValue: MyInterfaceOne, currentIndex: number, array: MyInterfaceOne[]) => MyInterfaceOne'.

但是,当将功能签名从更改为时MyInterfaceOne[] | MyInterfaceTwo[](MyInterfaceOne|MyInterfaceTwo)[]它可以工作。

有人可以向我解释这两者之间的区别吗?

signature typescript typescript-typings

4
推荐指数
1
解决办法
48
查看次数

从项目根目录运行子文件夹的基准测试

我有一个带有二进制文件的项目,入口点位于./cmd/<my-project>/main.go. 我在./cmd/<my-project>/main_test.go.

现在我想从存储库根目录执行这个基准测试。我试图以go test -bench=./cmd/<my-project>/main各种交替方式(例如go test -bench=./cmd/<my-project>/main_test.gogo test -bench=./cmd/<my-project>)执行类似的操作,但我无法让它工作。

我总是得到的错误是:

can't load package: package github.com/<username>/<my-project>: no Go files in /home/<user>/go/src/github.com/<username>/<my-project>

这是真的,*.go我的项目根目录中没有文件。

我想出的只是首先切换到目录并使用`go test -bench= 运行基准测试。

然而,由于我的程序依赖于当前的工作目录,结果在很大程度上取决于能够在另一个目录而不是目录中执行它会很棒cmd/<my-project>。(如果这好不好不是问题的一部分:))

第一条评论后更新:

我让它运行,go test -bench=. /cmd/<my-project>但基准测试被执行,就好像它会在./cmd/<my-project>目录中运行一样。我注意到“正常测试”中的类似行为 - 但这对我来说在任何时候都不是问题。

因此,我的程序确实会根据当前工作目录扫描当前目录中的文件目录,这会导致仅找到两个文件 (main.gomain_test.go),其中基准测试并没有真正的帮助。

benchmarking go

3
推荐指数
1
解决办法
1052
查看次数

何时使用 `parent` 以及何时使用 `root` 作为 GraphQL-resolver 函数中的第一个参数

我看过一些教程和示例,它们有时使用parent有时使用root作为他们在 graphql 解析器中的第一个参数。

在什么情况下正确的命名是什么?为什么?

例如(nodejs):

signup: (root, args, context, info) => signup(root, args, context, info)
Run Code Online (Sandbox Code Playgroud)

对比

signup: (parent, args, context, info) => signup(parent, args, context, info)
Run Code Online (Sandbox Code Playgroud)

或在进行注册的函数中:

const signup(root, args, context, info) = {
    // do magic stuff
}
Run Code Online (Sandbox Code Playgroud)

对比

const signup(parent, args, context, info) = {
    // do magic stuff
}
Run Code Online (Sandbox Code Playgroud)

javascript naming-conventions node.js graphql graphql-js

1
推荐指数
1
解决办法
365
查看次数