Code Monkey home page Code Monkey logo

convert-snippets's Issues

Convert Ultisnips snippets to vscode failed.

donie@Donies  ~/.vim/UltiSnips   master ●  convert-snippets php_laravel.snippets 1.json -- INSERT --
/Users/donie/.nvm/versions/node/v7.5.0/lib/node_modules/convert-snippets/src/parse.js:12
...(description ? { description } : {}),
^^^
SyntaxError: Unexpected token ...
at Object.exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/donie/.nvm/versions/node/v7.5.0/lib/node_modules/convert-snippets/src/generate.js:2:19)
at Module._compile (module.js:571:32)

The content of php_laravel.snippets is:

snippet lvalidator "参数检验"
$validator = Validator::make($${1:request->all()}, [
${2}
]);
if ($validator->fails()) {
return $this->${3:response->}error($validator->errors()->first(), 422);
}
endsnippet

snippet luserid "当前用户ID" i
$this${1:->auth}->user()->id${0}
endsnippet

snippet lreturn "返回JSON" b
return $this->${1:response->}success(${2});${0}
endsnippet

snippet lfail "返回错误响应" i
return $this->${1:response->}error(${2}, ${3:500});${0}
endsnippet

snippet lerr "Log::error()" b
Log::error('${1}'${2:.json_encode(${3:$request->all()})});${0}
endsnippet

snippet lctbl "migration: create table" b
Schema::create('${1:users}', function (Blueprint $table) {
${2:$table->increments('id')->comment('ID');}${0}
});
endsnippet

snippet ltbl "migration: alter table" b
Schema::table('${1:users}', function (Blueprint $table) {
${2}
});${0}
endsnippet

snippet lstring "migration: table->string()" b
$table->string('${1:email}', ${2:50})${3:->nullable()}->comment('${4:电邮}');${0}
endsnippet

snippet lint "migration: table->integer()" b
$table->integer('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet luint "migration: table->unsignedInteger()" b
$table->unsignedInteger('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet lbint "migration: table->bigInteger()" b
$table->bigInteger('${1:user_id}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:用户ID}');${0}
endsnippet

snippet lubint "migration: table->unsignedBigInteger()" b
$table->unsignedBigInteger('${1:user_id}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:用户ID}');${0}
endsnippet

snippet ltint "migration: table->tinyInteger()" b
$table->tinyInteger('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet lutint "migration: table->unsignedTinyInteger()" b
$table->unsignedTinyInteger('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet lsint "migration: table->smallInteger()" b
$table->smallInteger('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet lusint "migration: table->unsignedSmallInteger()" b
$table->unsignedSmallInteger('${1:age}')${3:->nullable()}${4:->default(${5:0})}->comment('${6:年龄}');${0}
endsnippet

snippet ldecimal "migration: table->decimal()" b
$table->decimal('${1:price}', ${3:10}, ${4:2})${5:->nullable()}${6:->default(${7:0})}->comment('${8:价格}');${0}
endsnippet

snippet lbool "migration: table->boolean()" b
$table->boolean('${1:email}')${2:->nullable()}${3:->default(${4:1})}->comment('${5:是否显示}');${0}
endsnippet

snippet ltss "migration: table->timestamps()" b
$table->timestamps();
endsnippet

snippet lts "migration: table->timestamp()" b
$table->timestamp('${1}')${2:->nullable()}${3:->default(${4:1})}->comment('${5:是否显示}');${0}
endsnippet

snippet ldrop "migration: Schema::drop()" b
Schema::drop('${1:users}');${0}
endsnippet

snippet ldropcol "migration: $table->dropColumn()" b
$table->dropColumn('${1}');${0}
endsnippet

snippet ltext "migration: table->text()" b
$table->text('${1:desc}')${2:->nullable()}->comment('${3:描述}');${0}
endsnippet

snippet ldatetime "migration: table->datetime()" b
$table->datetime('${1:created_at}')${2:->nullable()}->comment('${3:创建时间}');${0}
endsnippet

snippet laction "controller->action()" b
/**

  • ${4:Description}
  • @param Request $request 请求对象${5}
  • @return Illuminate\Http\JsonResponse
  • @author donieli
  • @SInCE ${6:1.0}
  • @Version $6
    */
    public function ${1:actionName}(Request $request${2:, $${3:id}})
    {
    ${8:// TODO: finish this.}
    }${0}
    endsnippet

snippet ..where "->where()" i
->where('${1:id}', ${2:'${3}', $${4:id}})${0}
endsnippet

snippet ..key "->whereKey()" i
->where${1:Key}(${2:$${3:var}})${0}
endsnippet

snippet ..or "->orWhere()" i
->orWhere('${1:id}', ${2:'${3}', $${4:id}})${0}
endsnippet

snippet ..bt "->whereBetween() or ->whereNotBetween()" i
->where${1:Not}Between('${2}', ${3:[${4}, ${5}]})${0}
endsnippet

snippet ..in "->whereIn() or ->whereNotIn()" i
->where${1:Not}In('${2:id}', ${3:$${4:ids}})${0}
endsnippet

snippet ..null "->whereNull() or ->whereNotNull" i
->where${1:Not}Null('${2}')${0}
endsnippet

snippet ..raw "->whereRaw()" i
->whereRaw('${1}')${0}
endsnippet

snippet ..hav "->having()" i
->having('${1}', '${2:>}', ${3})${0}
endsnippet

snippet ..havraw "->havingRaw()" i
->havingRaw('${1}')${0}
endsnippet

snippet ..when "->when()" i
->when(${1}, function ($${2:query}) ${3:use ($${4:request}) }{
${5}
}${6})${0}
endsnippet

snippet ..order "->orderBy()" i
->orderBy(${1:'${2}', '${3:desc}'})${0}
endsnippet

snippet ..insert "->insert() or ->insertGetId()" i
->insert${1:GetId}(${2})${0}
endsnippet

snippet ..update "->update()" i
->update(${1})${0}
endsnippet

snippet ..group "->groupBy()" i
->groupBy('${1}')${0}
endsnippet

snippet ..page "->paginate()" i
->paginate($${1:size}))${0}
endsnippet

snippet ..page2 "->skip()->take()" i
->skip(($${1:page} - 1) * $${2:size})->take($${2:size})${0}
endsnippet

snippet ..sel "->select()" i
->select(${1})${0}
endsnippet

snippet ..add "->addSelect()" i
->addSelect(${1})${0}
endsnippet

snippet ..get "->get()" i
->get()${0}
endsnippet

snippet ..fir "->first()" i
->first()${0}
endsnippet

snippet ..count "->count()" i
->count(${1})${0}
endsnippet

snippet ..min "->min()" i
->min('${1}')${0}
endsnippet

snippet ..max "->max()" i
->max('${1}')${0}
endsnippet

snippet ..avg "->avg()" i
->avg('${1}')${0}
endsnippet

snippet ..sum "->sum()" i
->sum('${1}')${0}
endsnippet

snippet ..dist "->distinct()" i
->distinct()${0}
endsnippet

snippet ..join "->join()" i
->join('${1}', ${2:'${3}', '${4:=}', '${5}'})${0}
endsnippet

snippet ..ljoin "->leftJoin()" i
->leftJoin('${1}', ${2:'${3}', '${4:=}', '${5}'})${0}
endsnippet

snippet ..rjoin "->rightJoin()" i
->rightJoin('${1}', ${2:'${3}', '${4:=}', '${5}'})${0}
endsnippet

snippet ..on "->on()" i
->on('${1}', '${2}', '${3}')${0}
endsnippet

snippet ..exi "->whereExists() or ->whereNotExists()" i
->where${1:Not}Exists(${2})${0}
endsnippet

snippet ..val "->value()" i
->value('${1}')${0}
endsnippet

snippet ..plu "->pluck()" i
->pluck('${1}')${0}
endsnippet

snippet ..incr "->increment()" i
->increment('${1}'${2:, ${3:10}})${0}
endsnippet

snippet ..decr "->decrement()" i
->decrement('${1}'${2:, ${3:10}})${0}
endsnippet

snippet ..del "->delete()" i
->delete()${0}
endsnippet

snippet ..from "->from()" i
->from('${1}')${0}
endsnippet

snippet ..lst "->latest()" i
->latest()${0}
endsnippet

snippet ..ost "->oldest()" i
->oldest()${0}
endsnippet

snippet ..sql "->toSql()" i
->toSql()${0}
endsnippet

snippet dbc "DB::connection()" i
DB::connection('${1}')${0:;}
endsnippet

snippet dbtbl "DB::table()" i
DB::table('${1}')${0}
endsnippet

snippet dbraw "DB::raw()" i
DB::raw('${1}')${0}
endsnippet

snippet dbstmt "DB::statement()" b
DB::statement('${1}');${0}
endsnippet

snippet dbbegin "DB::beginTransaction()" b
DB::beginTransaction();
endsnippet

snippet dbroll "DB::rollBack()" b
DB::rollBack();
endsnippet

snippet dbcommit "DB::commit()" b
DB::commit();
endsnippet

snippet lget "$request->get()" i
$request->get('${1}'${2:, ${3:1}})${0}
endsnippet

snippet lhas "$request->has()" i
$request->has('${1}')
endsnippet

snippet lresult "return ['totalPages', 'result']" b
return [
'totalPages' => $${1:totalPages},
'result' => $${2:${3:query}->get()},
];
endsnippet

snippet ltotal "calc $totalPages" b
$${1:totalNum} = $${2:query}->count();
$${3:totalPages} = ceil($${4:totalNum} / $${5:size});
endsnippet

snippet lmake "$this->app->make()" b
$${1:var} = $this->app->make(${2});${0}
endsnippet

snippet lins "$this->app->instance()" b
$this->app->instance(${1:User}::class, $${2:fakeUser});${0}
endsnippet

snippet lsing "$this->app->singleton()" b
$this->app->singleton('${1:OSS}', function ($app) {
${1}
});${0}
endsnippet

snippet dd "dd()" b
dd($1);${0}
endsnippet

snippet lqlog1 "DB::connection()->enableQueryLog()" b
\DB::connection()->enableQueryLog();${0}
endsnippet

snippet lqlog2 "DB::getQueryLog()" b
$logs = \DB::getQueryLog();${0}
endsnippet

Multiples prefix are not handled

When trying to convert a snippet

"prefix": ["Hello World", "HW"]

it just throw an error saying something like "split() of prefix is undefined"

In order I think this should be impletment:

  • Quickfix: put a error message
  • Quickfix: pick the first one with a warning
  • Fix: handling all the prefix

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.