Skip to content

Added keywords for 1C query syntax#4321

Open
AlexandraG-code wants to merge 5 commits into
highlightjs:mainfrom
AlexandraG-code:feature/Added-support-for-1C-query-syntax
Open

Added keywords for 1C query syntax#4321
AlexandraG-code wants to merge 5 commits into
highlightjs:mainfrom
AlexandraG-code:feature/Added-support-for-1C-query-syntax

Conversation

@AlexandraG-code

Copy link
Copy Markdown

Description

Added missing keywords for 1C query language including OPERATOR, WHERE, ORDER BY, GROUP BY, and other SQL-like constructs specific to 1C platform.

Motivation and Context

Currently, some 1C query language keywords are not properly highlighted. This change improves the developer experience when working with 1C queries by providing more accurate syntax highlighting.

How Has This Been Tested?

  • Tested with various 1C query examples
  • Verified that existing highlighting for other languages remains unchanged
  • Checked different color themes

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Comment thread src/languages/1c.js Outdated
Author: Stanislav Belov <stbelov@gmail.com>
Description: built-in language 1C:Enterprise (v7, v8)
Category: enterprise
Category: enterprise, common

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common is decided by core team. Please remove this. I don't think we'll be adding 1C to the common build anytime soon.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed common from category

Comment thread src/languages/1c.js Outdated
Comment on lines +45 to +47
// Дополнительные объекты
+ 'внешнийисточникданных внешняяобработка внешнийотчет '
+ 'общийреквизит общиймодуль общаяформа общиймакет ';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment looks off.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned the comment with the rest of the code. Ran ESLint --fix to ensure consistent formatting.

Comment thread src/languages/1c.js

// keyword : ключевые слова
const KEYWORD = v7_keywords + v8_keywords;
const KEYWORD = v7_keywords + v7_query_keywords + v8_keywords + v8_query_keywords;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we not support query keywords before at all?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, keywords in queries weren't supported at all; the module's author confirmed this.

Comment thread src/languages/1c.js Outdated
const NUMBERS = hljs.inherit(hljs.NUMBER_MODE);

// operator : Звездочка для выбора всех полей
const OPERATORS = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what an operator is or what this rule is trying to match, please provide some markup tests with examples.

Comment thread src/languages/1c.js Outdated
Comment on lines +512 to +515
begin: 'ЕСТЬNULL|ВЫРАЗИТЬ|РАЗНОСТЬДАТ|ДАТАВРЕМЯ|ГОД|МЕСЯЦ|ДЕНЬ|ДЕНЬГОДА|ДЕНЬНЕДЕЛИ|НЕДЕЛЯГОДА|ЧАС|МИНУТА|СЕКУНДА|НАЧАЛОПЕРИОДА|КОНЕЦПЕРИОДА|ДОБАВИТЬКДАТЕ|СУММА|КОЛИЧЕСТВО|МИНИМУМ|МАКСИМУМ|СРЕДНЕЕ',
end: '\\(',
returnBegin: true,
contains: [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this instead with regex.lookahead? We're trying to deprecate returnBegin.

Or just modify this rule itself to had className: function built in and match the trailing ( using look-ahead. Again the goal to not use returnBegin.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced returnBegin with regex.lookahead

@joshgoebel

Copy link
Copy Markdown
Member

What is your interest in 1C... would you like to become the defacto maintainer? It's really not practical to maintain this in core since I can't even read 99% of the file...

@AlexandraG-code
AlexandraG-code force-pushed the feature/Added-support-for-1C-query-syntax branch from 00547ba to 42723db Compare July 16, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants