Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[language-support] Add support for ObjectPascal #1426

Closed
pakLebah opened this issue May 24, 2018 · 12 comments
Closed

[language-support] Add support for ObjectPascal #1426

pakLebah opened this issue May 24, 2018 · 12 comments

Comments

@pakLebah
Copy link

I know PrismJS already supports Pascal language. However, modern Pascal language –that's being used by Delphi, Free Pascal, Oxygene, etc– tend to call itself as Object Pascal, instead of just simple Pascal. Because the latter is mostly known as and associated to the old school Wirth's Pascal of the 70's.

So, I propose either PrismJS renames its Pascal language into ObjectPascal, or create a duplicate of Pascal language and name it as ObjectPascal.

Why the name is important? Because I'm using VS Code to write Object Pascal programs with OmniPascal extension. I'm also using Bracket Pair Colorizer extension. The problem is… OmniPascal extension only supports ObjectPascal language, while Bracket Pair extension only support Pascal language. Bracket Pair extension is using PrismJS as its language definition tool, so I have to ask PrismJS if I want Bracket Pair extension to support a new language.

Yes, I know it's a bit complicated relationship that I have to live on if I want to write Object Pascal programs using those extensions. Hopefully you'll understand.

Thank you. 😊

@Golmote
Copy link
Contributor

Golmote commented May 24, 2018

Hi! Thanks for reporting.

If we were to add ObjectPascal to Prism, it would be added as an alias to the pascal component, along with TurboPascal and FreePascal. But I'm not even sure Bracket Pair Colorizer can use aliases at the moment, seeing it already has custom language name associations: https://github.com/CoenraadS/BracketPair/blob/master/src/documentDecorationManager.ts#L129

It appears that @CoenraadS already had to deal with language name mappings for its extension in the past (https://github.com/CoenraadS/BracketPair/issues/99, https://github.com/CoenraadS/BracketPair/issues/128, https://github.com/CoenraadS/BracketPair/issues/131...). Maybe this issue should be fixed the same way here. Thoughts, @CoenraadS?

@CoenraadS
Copy link

CoenraadS commented May 24, 2018

Is there a better way? I would like to be able to pass an alias to the loadLanguages function and have it choose the correct parameters, so I don't have to do so myself. This code was actually from before loadLanguages was available, so maybe it can already handle aliases, but I didn't check very hard.

@pakLebah
Copy link
Author

pakLebah commented May 24, 2018

@Golmote: The language are Pascal (the classic one) and ObjectPascal (the modern one). Delphi, TurboPascal (who is still using TP anyway?), FreePascal, and Oxygene are the names of compilers that implement Pascal language in various dialects. Along with those popular Pascal compilers, there are many other Pascal compilers out there with its own dialect e.g. NewPascal, SmartPascal, Turbo51, PascalABC, etc. but even those are still using either Pascal or ObjectPascal language, despite their dialects are not completely compatible. So, PrismJS should only support Pascal and ObjectPascal, not the compiler names.

@Golmote
Copy link
Contributor

Golmote commented May 25, 2018

@CoenraadS I think loadLanguages can't work with aliases at the moment. But it definitely could, so I just created #1427. Yet, I don't know if Prism would add all the aliases you defined in your getPrismLanguageID function (like scad or apex which seem to be actual languages, even if they might look like existing ones, or javascriptreact and typescriptreact which are really weird names for JSX and TSX IMO).

@pakLebah You seem to know your stuff, so i'll trust you on this ^^. We could then add only objectpascal as an alias to the pascal component.

@pakLebah
Copy link
Author

@Golmote: Thank you. I've been a professional Pascal programmer for more than fifteen years, mostly with Delphi and Free Pascal. Well… it was before I retired a few years ago. Now I'm doing programming just for fun and hobby So, yes… I know this Pascal stuffs well enough. 😊

@CoenraadS
Copy link

@Golmote Great! I was just talking about the PrismJS aliases also, not vscode specific ones or languages hacks I did just because existing languages are good enough to get the bracket information.

@mAAdhaTTah
Copy link
Member

@Golmote You've added ObjectPascal as an alias for Pascal. Is there any other action item here?

@Golmote
Copy link
Contributor

Golmote commented Jun 3, 2018

@mAAdhaTTah Yes, we need to make loadLanguages() work with aliases.

@mAAdhaTTah
Copy link
Member

@Golmote Can we close this one in favor of #1427?

@Golmote
Copy link
Contributor

Golmote commented Jun 3, 2018

We can.

@Golmote Golmote closed this as completed Jun 3, 2018
mAAdhaTTah added a commit that referenced this issue Jun 5, 2018
* gh-pages: (33 commits)
  Add double-class specificity hack (#1435)
  Moved tutorial link to the end of the list
  Make line-numbers styles more specific
  Fix mixed content warning
  Create CNAME
  Delete CNAME
  Update documentation for node & webpack usage
  Handle optional dependencies in `loadLanguages()` (#1417)
  Add `objectpascal` as an alias to `pascal` (see #1426)
  Add support for XQuery. Fix #1405 (#1411)
  Website: Fix Download page not handling multiple dependencies when from Redownload URL
  JSX: Add support for fragments short syntax. Fix #1421
  Support for Template Toolkit 2 (#1418)
  ASP.NET should require C#
  Run gulp
  Move guard into conditional and check for language
  Don't process language if block language not set
  JSX: Allow for two levels of nesting inside JSX tags. Fix #1408
  Add missing reference to issue in specific test.
  Powershell: Allow for one level of nesting in expressions inside strings. Fix #1407
  ...

# Conflicts:
#	components/prism-kotlin.js
@shaunroselt
Copy link

Maybe add an alias for 'Delphi' also?

@RunDevelopment
Copy link
Member

@shaunroselt As @pakLebah pointed out: Delphi is merely the name of a compiler for a Pascal/ObjectPascal dialect and therefore shouldn't be classified as its own language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants