Packages: Url highlighting

Created on 20 Dec 2017  路  5Comments  路  Source: sublimehq/Packages

[Feature Request] would you consider adding a scope name for urls, like in markdown, for other syntaxes.

Most helpful comment

I concur. Adding URL highlighting to, say, the JavaScript syntax would be inappropriate because the JavaScript language has no concept of URLs. There are some languages like Markdown in which URLs have real syntactic significance, and these languages generally do highlight URLs as appropriate.

Adding URL highlighting to the core packages would be a tremendous undertaking, and it's unlikely that third-party packages would follow suit. In addition, because some languages do have syntactically significant URLs, such an effort would inevitably lead to conflict between the correct specific behavior for a certain language and the generic behavior for languages in general. Furthermore, we would be opening ourselves up to the possibility that a language that does not currently have syntactically significant URLs will gain them in the future, at which point we would probably have to make a breaking change to that syntax definition.

A plugin-based solution has none of these problems. It would be much easier to implement, it would work with every syntax without interference, and it would be simpler for a user to configure (e.g. turn it off). If you are dissatisfied with the popular Clickable URLs package, then I would open an issue there with your suggestions, or simply fork it and modify it however you'd like. (It doesn't look very complicated.)

All 5 comments

why only in comments and why only C# and PHP ?

Because it has to be added explicitly and everywhere they should be matched.

I honestly believe that highlighting (and doing other stuff) with URLs is plugin area, since this doesn't actually have anything to do with the syntax you're working with most of the time.

I concur. Adding URL highlighting to, say, the JavaScript syntax would be inappropriate because the JavaScript language has no concept of URLs. There are some languages like Markdown in which URLs have real syntactic significance, and these languages generally do highlight URLs as appropriate.

Adding URL highlighting to the core packages would be a tremendous undertaking, and it's unlikely that third-party packages would follow suit. In addition, because some languages do have syntactically significant URLs, such an effort would inevitably lead to conflict between the correct specific behavior for a certain language and the generic behavior for languages in general. Furthermore, we would be opening ourselves up to the possibility that a language that does not currently have syntactically significant URLs will gain them in the future, at which point we would probably have to make a breaking change to that syntax definition.

A plugin-based solution has none of these problems. It would be much easier to implement, it would work with every syntax without interference, and it would be simpler for a user to configure (e.g. turn it off). If you are dissatisfied with the popular Clickable URLs package, then I would open an issue there with your suggestions, or simply fork it and modify it however you'd like. (It doesn't look very complicated.)

Was this page helpful?
0 / 5 - 0 ratings