Giter Site home page Giter Site logo

onecentlin / laravel-blade-snippets-vscode Goto Github PK

View Code? Open in Web Editor NEW
134.0 134.0 37.0 984 KB

Laravel blade snippets and syntax highlight support for Visual Studio Code

License: MIT License

TypeScript 85.29% JavaScript 0.72% Blade 13.99%
blade laravel laravel-blade-snippets snippets visual-studio-code vscode vscode-extension

laravel-blade-snippets-vscode's People

Contributors

1cbyc avatar abdelrhmansaid avatar adevade avatar ayatkyo avatar brayancaro avatar caddydz avatar cpoftea avatar dependabot[bot] avatar hasanalyazidi avatar izcream avatar justinbyrne avatar lakuapik avatar mikebronner avatar onecentlin avatar solicomo avatar thecolorred avatar tiansin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-blade-snippets-vscode's Issues

ON saving a .blade file it inlines all blade syntax

OK when I write a blank blade set up as below

    @extends('layouts.main') 
    @section('content')

    @stop

Then on saving it inlines the code as follows.

@extends('layouts.main') @section('content') @stop

And when putting html code within the content section it still only inlines the top part eg below:

  @extends('layouts.main') @section('content')
     <div>

     </div>
   @stop`

Is there a setting or config needs sorting or is this a conflict etc

Enable Emmet for Blade VS Code 1.5+

When I copied the given code to my User Settings it didn't work.

"emmet.syntaxProfiles": {
    "blade": "html"
},

However, the code below seems to activate Emmet for Blade again.

"emmet.includeLanguages": {
    "blade": "html"
},

Thanks for a great extension!

Suggestion: Make Blade directive and `@` same color as functions in theme.

Right now the blade directives appear in the same color as HTML tags. It would be good to visually differentiate blade directives from tags, my suggestion would be to make them the same color that functions are defined as in the syntax theme.

My guess is that the blade grammar is setting blade directives as tags, instead of functions?

Any suggestions? (I haven't figured out how to manually override the setting in user settings, if that is even at all possible.)

Feature: Blade Template Formatting

Great plugin I found it really useful, but I do notice that formatting on save or any other type of formatting of the HTML markup doesn't occur as it does in a normal .html file.

Is it possible to have the formatting work in blade templates?

Tag attributes completition

This is in html file:
html
While in blade:
blade
Notice the indent and the tag attributes feature. The snippets are working and my user settings are

"emmet.triggerExpansionOnTab": true,
    "emmet.includeLanguages": {
        "blade": "html",
    },

as recommended.

javascript autocompletion not working in script tag

I hope this issue will be fix soon.. Blade file doesn't work like HTML file that has javascript autocompletion inside script tag. If I change blade to HTML file, javascript autocompletion will work but then syntax highlight from Laravel Snippet will stop to work.

Blade syntax linting at script tag

vscode has built in Javascript syntax linter when we type js code in script tag on HTML file. But in blade file, it's not working. Hope this included in next update.

screenshot from 2018-02-20 11-49-24

Double emmet suggestions in the latest update

The Readme has the below instruction

screen shot 2018-02-17 at 5 20 20 pm

The above is needed for languages that do not have in built emmet support

The latest update to this extension uses a fork of the html language server which supports emmet. So now, users who follow the above instruction will get double emmet suggestions

screen shot 2018-02-17 at 5 21 32 pm

[code formatting consistency]

In the Laravel docs, and even in the auto-generated views from the command php artisan make:auth some - not all - blade directives such as @if, @if @else, @foreach, @forelse have a space right before the opening parenthesis.

@if($condition)

@if ($condition)

I know this is just a very minor issue but I think you should apply this to the snippets for the sake of consistency with the framework.

@section issues

Hello, and thanks for this package!

I am having some issues with formatting of @section, as per the attached image. Any ideas?

image

Turn off syntax highlighting but keep snippets

Is it possible to turn off the syntax highlighting and keep the snippets?

I use another Extension that works better for blade highlighting but this extension just overwrites the syntax highlighting if it's installed so I can't use the snippets which are great.

Thanks

Disable blade comments setting?

Could we get an option to disable blade comments? I never use blade comments and prefer to use html comments in my blade files

can you add support for Envoy.blade.php ?

I guess this is a very special file because it doesn't have your average blade tags.. but it ships with Laravel and a lot of people use it.. Right now if I add

"files.associations": {
    "*.blade.php": "html"
}

as you suggested in the thread about blade formatting, then it makes everything white and no longer highlights the blade functions

@setup
require __DIR__.'/vendor/autoload.php';
$dotenv = new Dotenv\Dotenv(__DIR__);
try {
$dotenv->load();
$dotenv->required(['DEPLOY_SERVER', 'DEPLOY_REPOSITORY', 'DEPLOY_PATH'])->notEmpty();
} catch ( Exception $e )  {
echo $e->getMessage();
}

$server = getenv('DEPLOY_SERVER');
$repo = getenv('DEPLOY_REPOSITORY');
$path = getenv('DEPLOY_PATH');
$branch = getenv('DEPLOY_BRANCH');
$slack = getenv('DEPLOY_SLACK_WEBHOOK');

if ( substr($path, 0, 1) !== '/' ) throw new Exception('Careful - your deployment path does not begin with /');

$date = ( new DateTime )->format('YmdHis');
$env = isset($env) ? $env : "production";
$branch = isset($branch) ? $branch : "master";
$path = rtrim($path, '/');
$release = $path.'/'.$date;
@endsetup

@servers(['web' => $server])

@task('init')
if [ ! -d {{ $path }}/current ]; then
cd {{ $path }}
git clone {{ $repo }} --branch={{ $branch }} --depth=1 -q {{ $release }}
#echo "git clone {{ $repo }} --branch={{ $branch }} --depth=1 -q {{ $release }}"
echo "Repository cloned"

mv {{ $release }}/storage {{ $path }}/storage
ln -s {{ $path }}/storage {{ $release }}/storage
ln -s {{ $path }}/storage/public {{ $release }}/public/storage
echo "Storage directory set up"

cp {{ $release }}/.env.live {{ $path }}/.env
ln -s {{ $path }}/.env {{ $release }}/.env
echo "Environment file set up"

rm -rf {{ $release }}
echo "Deployment path initialised. Run 'envoy run deploy' now."
else
echo "Deployment path already initialised (current symlink exists)!"
fi
@endtask

@story('deploy')
deployment_start
deployment_links
deployment_composer
{{--deployment_migrate--}}
deployment_cache
{{--deployment_optimize--}}
deployment_finish
deployment_option_cleanup
@endstory

...

I also really can't get the blade formatting to work at all, it makes my Envoy file wrap on a single line even though I'm using your settings you also posted in that other thread

Strange syntax highlights

Hi, thanks for your plugin!

i'm wondering tho, why this happens: ( the blue highlights )
screenshot_2017-04-12_18-14-20

its the default Dark+ theme. ( and happens with most themes )

it has successfully detected is a blade template:

screenshot_2017-04-12_18-14-20-laravel-blade

code:


<style type="text/css">
    @php
    if( is_front_page() ) {
      $service_page_id = App\monfortur_get_option( 'monfortur_options_page_services' );
      $image_id = get_post_meta( $service_page_id, 'services_box_service_banner_id', true );
      $preloader = "";
      $image_large = "";
      $image_full = "";
      if( ! empty( $image_id ) ) {

        $preloader = wp_get_attachment_image_src( $image_id, 'preloader' );
        if( $preloader ){
          $preloader = base64_encode( file_get_contents( $preloader[0] ) );

        }

Wrong comment with CTRL + / at in page js

Commenting with CTRL + / keeps adding html comment {{-- --}} instead of javascript comment //
And also after creating div tag and press enter, the cursor didn't automatically adjust to create newline between opening and closing tag. I mean it should be:

<div>
         |
</div>

not

<div>
|</div>

please fix this soon, thanks!

How do I change or disable this extensions auto-formatting?

Your extension auto formats my blade documents. I have the following block of code:

<input id="username" name="username" type="text" value="{{ old('username') }}">
@if ($errors->has('username'))
<div class="error">Username Error here</div>
@endif

And when I save the document or run "Format Document" it formats it to this:

<input id="username" name="username" type="text" value="{{ old('username') }}"> @if ($errors->has('username'))
<div class="error">Username Error here</div>
@endif

Really, really annoying. It is definitely this extension doing it to because if I disable all extensions it does not format the document. But if I then enable ONLY this extension, it formats the document.

How do I turn off this feature? Or how do I control the formatting rules? When I search in my settings for "laravel" I see zero settings to control this extension's features and behavior.

Also, kind of weird that It doesn't say anything about formatting on the extension page. If the extension is a "snippet" extension as the title implies maybe you should not add in hidden features like formatting that cannot be disabled.

Format issue

Auto fomat will format code

<option value='{{$k}}'{{($k == $product->status)?" SELECTED":null}}>{{$v}}</option>

to

<option value='{{$k}}' {{($k==$ product->status)?" SELECTED":null}}>{{$v}}</option>

and

@extends('admin.layouts.master')

@section('css')

to

@extends('admin.layouts.master') @section('css')

Is there any way to fix this?

vscode version 1.18.1

Missing syntax highlight in tag attributes

I've noticed that inside a tag (between < and >) the syntax highlight is completely missing. See this complex input tag template:

blade1

and compare to a version where I commented out the tag:

blade2

html elements not indenting With the latest vscode

In regular html pages if I type (below) and click enter while the cursor is in the middle of the tags

<p></p>

It will look like this:

<p>
   (indented content)
</p>

With the latest vscode and all extensions, it seems this extension is not executing the indent and leaving me with this when doing the same in a page.blade.php file:

Problems with Auto Indent

I noticed that there was another issue that covered the same topic but it was closed because it assumed the issue was related to VS Code due to PHP mode having the same problem. However, it looks like VS Code has fixed the problem with PHP mode and Auto Indent whereas this plugin still has the issue.

This is what happens in a normal HTML or PHP file:

<html>(cursor here)</html>

When I press enter it'll give me:

<html>
    (cursor here)
</html>

However, while in a Blade file I'll get this:

<html>
(cursor here)</html>

The other issue that dealt with this is here: #2

Auto indent not working

When using your extension, the auto indent feature does not work:

no-auto-indent

But when I switch the document language to HTML, it works again:

auto-indent

It's a rather small thing, but when you have to create a lot of elements this get's pretty annoying.

  • VS Code Version 1.6.1 (9e4e44c19e393803e2b05fe2323cf4ed7e36880e)
  • Extension Version 1.4.0

Although I don't think this makes any difference, but I also included this in my settings:

"emmet.syntaxProfiles": {
    "blade": "html"
},

I file this issue here rather than in the VS Code main repo, as the indentation works once I switch to HTML. I'm sorry if I'm mistaken.

If you need any more information, just tell me.

You need to look at how your handling php/html Link Below

I have been building blade projects in vscode did not have an issue until a few weeks ago. I made one issue and was basically ignored after a few responses.

Below I have a link of my issue with the vscode team who shows screenshots and instructions on your extensions (as well as all blade extensions) on how to fix the formatting issue.

#39142

This is not an auto indent or emmet issue, they have laid out requirements needed for the auto indent formatting that all the blade extensions are not currently following, so I am making this issue in hopes that you can look and figure out how to fix this.

As of right now working in blade with the latest version of the stable and the insider build of vscode is not possible as it has 0 of the functionalities this extension is suppose to do.

Highlighting open and closing html tags

I may be missing a feature, but my HTML highlighting seems to be gone.

Is there a way to see open and closing brackets on a tag similar to how the .html files work?

Emmet not working.

Emmet does not work in blade using the "Laravel Blade Snippets" extension, even after adding the following configuration:

    "emmet.syntaxProfiles": {
        "blade": "html"
    },
  • VSCode Version: 1.13.1
  • OS Version: Win 10.

Tag Matching

It would be nice if tag matching worked, because every time I need to match a opening div with a closing div I need to switch to html mode.

Currently if you put the cursor over a div tag it selects all of the div's

If I am not mistaken this could be included to support this https://github.com/Microsoft/vscode-html-languageservice

[Feature Request] Handling/Supporting Laravel Collective Forms

Currently Blade Snippets VsCode Auto-format function turns this code:

{!! Form::label('nome', 'Nome:') !!} 
{!! Form::text('nome', null, array('class' => 'form-control', 'style' => 'max-width:400px')) !!}

Into this:

{!! Form::label('nome', 'Nome:') !!} {!! Form::text('nome', null, array('class' => 'form-control', 'style' => 'max-width:400px'))
      !!}

It would be great if it would keep each {!! Form: * in its own line.
Thanks in advance

<?php ?> and @php @endphp tags not handled properly

If I use then the php inside just gets ignored when I format the document

Using cmd-/ to comment inside the tags however applies the wrong comment syntax

If I use @php @endphp, the wrong comment syntax are also applied, and if I use the format document it removes all lines breaks and puts everything on one line basically

indent not working in blade file

when i change syntax to html it's work correctly but when i change back to laravel blade indent not working. i add emmet syntaxprofile already.

how to solve this issue?

THX

Incorrect syntax highlighting in blade directives

c1umamdbrc

@inputRadio([
    'name' => 'tab',
    'value' => $posting->url ? 'url' : ($posting->contact ? 'existing' : 'new'),
    'name' => 'tab',
    'items' => $items,
])

Or here another example:

lhzacbfmrd

@inputSelect([
    'label' => 'Ansprechpartner',
    'name' => 'id',
    'value' => $posting->contact->id ?? null,
    'items' => $contacts->map(function($item) {
        return [
            'value' => $item->id,
            'label' => $item->name,
        ];
    }),
    'required' => true,
])

Problem for auto indent

When I create a new class for example ".abc" I use the tab it creates the div <div class="abc"></div> correctly, but when I press the Enter it does not ident correctly.

example:
image

i need:
image

Can someone help me?

My actual user settings
image

Closing curly brace breaks indentation

When writing a Blade Echo tag with double curly braces inside an HTML attribute, auto-close doesn't work and indentation breaks:

untitled

Outside the HTML tag, it works as expected.

Formatting breaking URLs in some cases

The following code that works:

<a href="{{ url("invoices/{$invoice->id}/mailable/invoice") }}" class="dropdown-item">Verify email to be sent</a>

is being replaced by

<a href="{{ url(" invoices/{$invoice->id}/mailable/invoice") }}" class="dropdown-item">Verify email to be sent</a>

Notice the space added in the URL, which breaks the URLs.

Parse fail

@section('sometag', Form::model($model, ['route' => array_merge(['abc', $model->id], request()->query()), 'method' => 'put', 'files' => true]))

Use space on format document

How do you use space when formatting the document? it always use tab, even if the settings below is set to space

Blade server crashed error after upgrading to 1.14.0

i just updated the extension to v1.14.0 and I am getting below error in my vscode

"The Blade Language Server server crashed 5 times in last 3 minutes. The server will not be restarted."

Error output

Error: Cannot find module '/Users/badalsurana/.vscode/extensions/onecentlin.laravel-blade-1.14.0/server/out/htmlServerMain.js' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Server.<anonymous> (/Users/badalsurana/.vscode/extensions/onecentlin.laravel-blade-1.14.0/node_modules/vscode-languageclient/lib/utils/electronForkStart.js:110:9) at emitOne (events.js:96:13) at Server.emit (events.js:191:7) at Pipe.onconnection (net.js:1486:8)

[Error - 3:10:42 PM] Connection to server got closed. Server will not be restarted.

Blade syntax broken with VSCode 1.20.0 release

With the new VSCode update, things seems to be pretty broken with this extension right now as this screenshot suggests :
blade syntax problem image

Here's the same screenshot with the PHP syntax enabled :
correct syntax from php language

Not only does this shows how the syntax is affected, this also means that other utilities are broken as well : snippets and autocompletion is also broken when you are located in the broken part of the syntax.
Take note that this screenshot tries to show that the above snippet works, while the one in yellow show No suggestions.
snippet are also broken

Comment using cmd + / end up with extra spaces

VSCode version: 1.12.1
Extension version: 1.17.0

Detail:
Cmd + / give me this (4 spaces inside comment block)

{{--    --}}

Anyway, b:comment give me the correct format.

Expected behavior:
It should give me this (2 spaces inside comment block)

{{--  --}}

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.