1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

Update lang#dart layer (#4228)

This commit is contained in:
Wang Shidong 2021-04-24 22:12:14 +08:00 committed by GitHub
parent 8e5cb41b39
commit 1512348f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 8 deletions

View File

@ -20,6 +20,10 @@
" name = "lang#dart"
" <
"
" @subsection Layer options
"
" 1. `dart_sdk_path`: Set the path of dart sdk, by default, it is ''.
"
" @subsection Key bindings
" >
" Mode Key Function
@ -44,10 +48,11 @@
if exists('s:flutter_job_id')
finish
else
let s:flutter_job_id = 0
endif
let s:flutter_job_id = 0
let s:dart_sdk_path = ''
let s:JOB = SpaceVim#api#import('job')
let s:NOTI =SpaceVim#api#import('notification')
@ -66,6 +71,11 @@ function! SpaceVim#layers#lang#dart#config() abort
call SpaceVim#mapping#space#regesit_lang_mappings('dart', function('s:language_specified_mappings'))
call SpaceVim#plugins#repl#reg('dart', ['pub', 'global', 'run', 'dart_repl'])
call add(g:spacevim_project_rooter_patterns, 'pubspec.yaml')
let g:deoplete#sources#dart#dart_sdk_path = s:dart_sdk_path
endfunction
function! SpaceVim#layers#lang#dart#set_variable(var) abort
let s:dart_sdk_path = get(a:var, 'dart_sdk_path', s:dart_sdk_path)
endfunction
function! s:language_specified_mappings() abort
@ -155,17 +165,17 @@ function! s:on_exit(...) abort
endfunction
function! s:flutter_emulators_launch() abort
call inputsave()
let emulators = input('emulators id:')
call inputrestore()
if !empty(emulators)
call s:JOB.start(['flutter', 'emulators', '--launch', emulators],
call inputsave()
let emulators = input('emulators id:')
call inputrestore()
if !empty(emulators)
call s:JOB.start(['flutter', 'emulators', '--launch', emulators],
\ {
\ 'on_stdout' : function('s:on_stdout'),
\ 'on_stderr' : function('s:on_stderr'),
\ }
\ )
endif
endif
endfunction

View File

@ -1857,6 +1857,10 @@ checker which is loaded in |SpaceVim-layer-checkers|. To enable this layer:
name = "lang#dart"
<
LAYER OPTIONS
1. `dart_sdk_path`: Set the path of dart sdk, by default, it is ''.
KEY BINDINGS
>

View File

@ -14,6 +14,7 @@ lang: zh
- [启用模块](#启用模块)
- [语法检查及代码格式化](#语法检查及代码格式化)
- [安装 dart-repl](#安装-dart-repl)
- [模块选项](#模块选项)
- [快捷键](#快捷键)
- [交互式编程](#交互式编程)
- [运行当前脚本](#运行当前脚本)
@ -56,6 +57,10 @@ lang: zh
pub global activate dart_repl
```
## 模块选项
- `dart_sdk_path`: 设置 dart sdk 的路径,默认是: `''`.
## 快捷键
### 交互式编程

View File

@ -13,6 +13,7 @@ description: "This layer is for Dart development, provide autocompletion, syntax
- [Layer](#layer)
- [Syntax checking && Code formatting](#syntax-checking--code-formatting)
- [Install dart-repl](#install-dart-repl)
- [Layer options](#layer-options)
- [Key bindings](#key-bindings)
- [Inferior REPL process](#inferior-repl-process)
- [Running current script](#running-current-script)
@ -58,6 +59,10 @@ You need to install the dart_repl via pub, pub is a build-in package manager in
pub global activate dart_repl
```
## Layer options
- `dart_sdk_path`: Set the path of dart sdk, by default, it is `''`.
## Key bindings
### Inferior REPL process