Coder Social home page Coder Social logo

adrhumphreys / vscode-silverstripe Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 12.0 863 KB

Basic template syntax highlighting for Silver Stripe template files.

Home Page: https://marketplace.visualstudio.com/items?itemName=adrianhumphreys.silverstripe

License: MIT License

TypeScript 84.62% JavaScript 15.38%

vscode-silverstripe's Introduction

Silverstripe

Provides SilverStripe syntax highlighting and snippets.

Powered by Sanchez

Features

  • Reads the project composer.lock file to determine the available snippets.
  • Php snippets follow psr-2 standards
  • Snippets inject use item if available and possible.
  • Supports 4.* and 3.*.
  • Uses full word prefixes so you don't have to remember abbreviations.
  • Includes snippets for addons modules such as tagfield and linkable.
  • .ss templates include scope and conditional indentation.
  • .ss templates support go to definition for <% include %>, <% themedCSS %> and <% themeJavascript %>.
  • .ss templates autocomplete paths include, themedCSS and themeJavascript. ie. includepagination will complete to <% include SilverStripe/Blog/Pagination %> if found in the appropriate directory.

Options

Add your own snippets

Enable emmet

Open Preferences -> Settings

Add below settings to enable Emmet for .ss files:

"emmet.includeLanguages": {
    "silverstripe": "html"
}

Contributions

Go for gold, if it adds value, add it and I'll merge it.

vscode-silverstripe's People

Contributors

acdr avatar adrhumphreys avatar blueo avatar ethanjohnstone avatar gorriecoe avatar jonom avatar oldstarchy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-silverstripe's Issues

Possible to disable snippets?

Recent updates have added a lot of snippets, which is nice, but they are appearing before the Emmet snippets in templates and before the PHP Intelephense snippets in PHP files and I find myself using those other snippets much more frequently. This means I've got to cycle through all the snippets from this plugin to get to the ones I want.

I primarily use this plugin for syntax highlighting, and I'm not opposed to some snippets too but I'm finding it to be a whole lot of noise right now, especially with both SS3 and SS4 snippets showing up. More configurability would be much appreciated.

Auto indent support

Thanks for this extension! It seems to work pretty well although I'm finding some of the things I can do with an html file don't work with a SS file. One example is auto indent... I like it when VSCode indents my lines automatically when I move them around. It seems a definition could be added to this extension to make that work, here is the info: https://code.visualstudio.com/updates/v1_14#_auto-indent-on-type-move-lines-and-paste

I'm not really following what is going on there but maybe it means something to you. I guess the indent rules could be copied from the html definition?

Snippets Overview/Cheatsheet

I think it would be really helpful to have an overview/cheatsheet of what snippets are available by default (like just a markdown file or something). If this is already available please point it out to me because I've had a look and haven't been able to find anything.

HTML Formatting

I noticed that the formatting breaks on the "id" html attribute. Escaping the the equals restores formatting. As far as I can tell so far It only occurs on that tag, If I experience any other issues related to formatting caused by attributes I'll add them here.

Broken:
<div class="row" id="MainContent">...blah.blah.blah...</div>

Temporary fix:
<div class="row" id\="MainContent">...blah.blah.blah...</div>

Edited: Forgot to escape my sample code...

Need HTML Snippet

I've added Silverstripe into VScode and while I have all the snippets setup for SilverStripe. I lost all the HTML snippets.

Is there a way to inherit the snippets from HTML file types?

Poor Intellisense performance in project with SilverStripe CMS requirement

I've been having on-and-off bad performance with Intellisense in PHP for the past few days, and seem to have tracked it down to only occurring when I have this module enabled, and a specific folder open (either on its own, or as part of a workspace).

In the composer.json for that folder:

{
    ...
    "type": "silverstripe-vendormodule",
    "require": {
        "silverstripe/cms": "^4.0"
    },
    ...
}

When I've got this folder open, it takes a few seconds for the Intellisense list to be populated, and if I close the folder, or roll this module back to 0.0.5, it seems to be working normally.

This doesn't appear to be happening when working in a proper SilverStripe project, i.e. no type key in the composer.json.

Any idea why this could be happening?

Extension issue

  • Issue Type: Bug
  • Extension Name: silverstripe
  • Extension Version: 1.0.6
  • OS Version: Darwin x64 20.3.0
  • VS Code version: 1.68.1
{
	"messages": [],
	"activationTimes": {
		"codeLoadingTime": 465,
		"activateCallTime": 41905,
		"activateResolvedTime": 15,
		"activationReason": {
			"startup": false,
			"extensionId": {
				"value": "adrianhumphreys.silverstripe",
				"_lower": "adrianhumphreys.silverstripe"
			},
			"activationEvent": "onStartupFinished"
		}
	},
	"runtimeErrors": [],
	"runningLocation": {
		"affinity": 0,
		"kind": 1
	}
}

Extension issue

  • Issue Type: Bug
  • Extension Name: silverstripe
  • Extension Version: 1.0.6
  • OS Version: Darwin x64 19.6.0
  • VSCode version: 1.50.1

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

Feature Suggestion: Go to Definition

With VSCode (and PHP Storm) you can use cmd/ctrl + click to navigate to a PHP class definition if you click on a place that it's used in the code.
In PHP Storm this also works inside silverstripe template files, if you click on the name inside an include tag.
For example:
if you were to use cmd+click on the text "PageHead" inside this: <% include PageHead %>, then the editor would attempt to navigate to the PageHead.ss file.
This would be super useful functionality to add for larger sites with more template files.

Sorry if this is the wrong place to suggest this, I'm not even sure if it's possible, I'm not well versed in vscode plugins.

Commenting Shortcut

Would be helpful if you could use the commenting shortcut for a line, just like HTML syntax... e.g. cmd+/ would comment the whole line.

formatting

it seems that using this, it removes the ability to format html. any idea how to handle this?

by simply setting the association in "files.associations" I can format .ss files, but obviously snippets and colors are gone.

Highlighting breaks after invalid css in <style> tag

Smallest reproducable example is

<style>a</style>

data- attributes are highlighted differently for some reason.
Adding {}</style> anywhere else in the file after the highlighting is broken will fix it.

<span class="foo" style="baz" data-foo="qux">bar</span>
<style>a</style>
<span class="foo" style="baz">bar</span>
<span class="foo" style="baz" data-foo="qux">bar</span>
{}</style>
<span class="foo" style="baz">bar</span>
<span class="foo" style="baz" data-foo="qux">bar</span>

image

I came accross this editing an email template that has HTML comment markers around the style content

<style>
  <!--
    .foo { bar: baz; }
  -->
</style>

However in this case I think its just treating --> as an unfinished selector.

The highlighting changes depending on the last bit of code before the closing </style> tag. The following three each have different results.

--> Not working
-->{ Not working, but different
-->{} OK

102 second startup time

  • Issue Type: Bug
  • Extension Name: silverstripe
  • Extension Version: 1.0.6
  • OS Version: Windows_NT x64 10.0.18362
  • VSCode version: 1.49.0-insider
{
	"messages": [],
	"activationTimes": {
		"codeLoadingTime": 219,
		"activateCallTime": 102047,
		"activateResolvedTime": 10,
		"activationReason": {
			"startup": false,
			"extensionId": {
				"value": "adrianhumphreys.silverstripe",
				"_lower": "adrianhumphreys.silverstripe"
			},
			"activationEvent": "onStartupFinished"
		}
	},
	"runtimeErrors": []
}

The project is a basic Craft CMS website template, with no SilverStripe template files. Running over Remote SSH, though opening empty projects over SSH works fine.

Highlights break with SS tags inside quotes

The default Page.ss template that the "Simple" theme includes breaks the highlighting, specifically this line:

<body class="$ClassName.ShortName<% if not $Menu(2) %> no-sidebar<% end_if %>" <% if $i18nScriptDirection %>dir="$i18nScriptDirection"<% end_if %>>

Attaching image of how it breaks:

screen shot 2018-09-10 at 17 09 13

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.