Project
PhpStorm/WebStorm
Priority
Normal
Type
Feature
State
Won't fix
Assignee
Alexey Gopachenko
Subsystem
No subsystem
Fix versions
No Fix versions
Affected versions
No Affected versions
  • Created by   Alexey Gopachenko
    2 years ago (07 Sep 2009 23:00)
  • Updated by   Alexey Gopachenko
    3 months ago (06 Feb 2012 01:07)
 
WI-242 Support language injection into YAML
3
Issue is visible to: All Users
  The issue is visible to the selected user group only
Comments (12)
 
History
 
Linked Issues (?)
 
Ziyad Saeed
  Ziyad Saeed
08 Sep 2009 02:02
2 years ago
here is an example from Symfony Documentation of Jobeet Model
The file is 020_jobs.yml

JobeetJob:
# Starts at the beginning of the line (no whitespace before)
<?php for ($i = 100; $i <= 130; $i++): ?>
  job_<?php echo $i ?>:
    category_id: programming
    company: Company <?php echo $i."\n" ?>
    position: Web Developer
    location: Paris, France
    description: Lorem ipsum dolor sit amet, consectetur adipisicing elit.
    how_to_apply: |
      Send your resume to lorem.ipsum [at] company_<?php echo $i ?>.sit
    is_public: true
    is_activated: true
    token: job_<?php echo $i."\n" ?>
    email: job@example.com
<?php endfor; ?>
Alexey Gopachenko
  Alexey Gopachenko
08 Sep 2009 11:28
2 years ago
As far as I see this is actually completely opposite task to that i thought it was initially – our example is actually PHP file but with YAML "outside".
The good news is that such cases are already supported in current version:
Just open settings and reassign yml extension to PHP file type and than select desired template language under "Template Data Languages"
Alexey Gopachenko
  Alexey Gopachenko
08 Sep 2009 11:59
2 years ago
Closing injection ticket until someone actually needs it.
Related Changes
Resolved Date
2 years ago (08 Sep 2009 11:59)
State
SubmittedWon't fix
Phoenix Zerin
  Phoenix Zerin
31 Jan 2012 21:32
3 months ago
Does this cause the YAML syntax outside the PHP tags to be syntax-colored/navigable/etc. as YAML? Or will it get treated as plaintext/HTML?
Alexey Gopachenko
  Alexey Gopachenko
01 Feb 2012 23:16
3 months ago
Yes.
Why not just try it?..
Phoenix Zerin
  Phoenix Zerin
02 Feb 2012 22:39
3 months ago
Good point. I tried it out, but it didn't work:

Everything inside the <?php ?> tags was correctly recognized as PHP, but there was no syntax coloring for the YAML code outside the <?php ?> tags, the Structure window was empty, etc.
Andriy Bazanov
  Andriy Bazanov
02 Feb 2012 23:47
3 months ago
@Phoenix Zerin
Syntax highlighting was OK for me. But Structure panel is not showing Yaml structure, only PHP variables in PHP tab.
Alexey Gopachenko
  Alexey Gopachenko
03 Feb 2012 18:39
3 months ago
Works correctly for us.
Phoenix Zerin
  Phoenix Zerin
04 Feb 2012 00:56
3 months ago
Thanks for verifying. I missed the part about changing the template data language.

Does that have to be configured for every .yml file in the project, or can I blanket-apply the Template Data Language setting to every applicable file?
Andriy Bazanov
  Andriy Bazanov
04 Feb 2012 02:28
3 months ago
@Phoenix Zerin
Template Data Language can be applied to a specific file or folder (so ALL files in that folder will inherit the new value). You cannot mass-apply it using filename mask (e.g. *.yml).
Phoenix Zerin
  Phoenix Zerin
04 Feb 2012 04:19
3 months ago
Doesn't that seem a little cumbersome for end users? Instead of PhpStorm being aware of PHP syntax in YAML files by default, users have to tell PhpStorm to treat all YAML files as PHP files and then manually override the setting on a per-file or per-folder basis.

It also would necessitate storing the .idea metadata folder in the source control repository, or else each developer on the team would have to duplicate this configuration workaround in her own environment for each project.
Alexey Gopachenko
  Alexey Gopachenko
06 Feb 2012 01:07
3 months ago
.idea folder is supposed to be stored in vcs. (excluding the workspace.xml file)