How to reference an existing scope in the pattern of a new one

Hello, I am using Webstorm 2019.1.3.

In the respective Webstorm docs ( it is mentioned how to create a new scope from existing scopes using a special syntax for the existing scope name. For example, $Scope1||$Scope2, declares a new scope which is the join of Scope1 and Scope2 files.

In theory it sounds simple but in reality I could not create a new scope from another existing scope reference successfully using the aforementioned syntax. This is unfortunate because I have a rather complex scope, which includes many folders with excluded subfolders, and I would like to declare other scopes based on that definition (for example work on a subset of files ending in *.spec.js). It's a shame to have to copy/paste its definition (look below) in order to apply the extra filters that I want.

The complex pattern defining my reference scope looks like this:

The question is how to reference existing scopes in the declaration (in fact the "pattern" field in the scopes dialogue) and if you can enhance the documentation with more accurate and verbose examples.

Comment actions Permalink

Hi there,

It works ... but it depends on an actual scope (at least in my tests: PhpStorm 2019.1.3).

Scope = pattern

CRLF = file:*web.config
PHP = file:*.php
This will work = $CRLF||$PHP

This does not:

JS = file:testing/watchers/js-merge//*
PHP = file:*.php
This will NOT = $JS||$PHP

Only files from PHP scope will be listed...

Comment actions Permalink

Thank you for your response Andriy.

From your examples, it seems like the parser responsible for analyzing and combining the above patterns/scopes needs some work to accept all the supported patterns used in scope creation. Partial support is just very confusing and not very helpful, specially if you spent a good chunk of time trying to see what went wrong in your pattern. Also, in my opinion, a mention of this limitation should be included in the docs.

Comment actions Permalink

@Thanos Kontis

Please create a ticket at the Issue Tracker (and leave the ticket number here, I'd like to watch it) for JetBrains devs to look into it.

I do not =work for JetBrains and do not know if it's a natural limitation (meant to be like that) or if it's a bug (which is more likely to me) or maybe it's something working with the syntax that I/you were using.


Please sign in to leave a comment.