alexkrechik / VSCucumberAutoComplete

Cucumber (Gherkin) Full Support Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete
MIT License
331 stars 82 forks source link

Can't format feature in Spanish or Italian (and other languages different by English) #336

Open bistick opened 4 years ago

bistick commented 4 years ago

Excellent, plugin but has some bugs. You cannot format in Spanish (and other languages)

It's the same in Spanish o Italian for examples.

# language: es
Característica: test
test

Esquema del escenario: test
test description

Dado given step
Y other given step
Cuando do something
Entonces do asserts "<check1>"
Ejemplos:
| check1 |
| test   |

My configuration:

{
    "java.configuration.updateBuildConfiguration": "automatic",

    "cucumberautocomplete.steps": [
        "src/test/java/stepdef/*.java"
    ],
    "cucumberautocomplete.syncfeatures": "src/test/resources/test/*.feature",
    "cucumberautocomplete.strictGherkinCompletion": false,
    "cucumberautocomplete.strictGherkinValidation": false,
    "cucumberautocomplete.smartSnippets": true,
    "cucumberautocomplete.stepsInvariants": true,
    "cucumberautocomplete.skipDocStringsFormat": true,
    "cucumberautocomplete.formatConfOverride": {
        "And": 3,
        "But": "relative",
    },
    "cucumberautocomplete.onTypeFormat": true,
    "editor.quickSuggestions": {
        "comments": false,
        "strings": true,
        "other": true
    },
    "cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then|Step)\\("
}
alexkrechik commented 4 years ago

Actually, cucumberautocomplete.formatConfOverride option could be added with all the words used in any non-English language, used defaults in English are:

const FORMAT_CONF: FormatConf = {
    'Ability': 0,
    'Business Need': 0,
    'Feature:': 0,
    'Scenario:': 1,
    'Background:': 1,
    'Scenario Outline:': 1,
    'Examples:': 2,
    'Given': 2,
    'When': 2,
    'Then': 2,
    'And': 2,
    'But': 2,
    '\\*': 2,
    '\\|': 3,
    '"""': 3,
    '#': 'relative',
    '@': 'relative',
};

In the future, I'll think regarding items grouping by language, but it would be better to create a separate issue for this. But please reply here if any problems found with cucumberautocomplete.formatConfOverride option.

duplostudio commented 4 years ago

I feel cucumberautocomplete.formatConfOverride solution conceptually wrong... Feels like a hack.

From Gherkin reference: "The language you choose for Gherkin should be the same language your users and domain experts use when they talk about the domain. Translating between two languages should be avoided. This is why Gherkin has been translated to over 70 languages." ... "A # language: header on the first line of a feature file tells Cucumber what spoken language to use - for example # language: fr for French. If you omit this header, Cucumber will default to English (en)."

So, if Gherkin is a necessary dependence for cucumber and then for this tool... why not use lib/gherkin-languages.json to load language variants and support # language: header?

With little effort supporting the language selection and reusing gherkin lang metadata, it will boost this tool user base with all non english coders (as I am).

alexkrechik commented 4 years ago

I feel cucumberautocomplete.formatConfOverride solution conceptually wrong... Feels like a hack.

From Gherkin reference: "The language you choose for Gherkin should be the same language your users and domain experts use when they talk about the domain. Translating between two languages should be avoided. This is why Gherkin has been translated to over 70 languages." ... "A # language: header on the first line of a feature file tells Cucumber what spoken language to use - for example # language: fr for French. If you omit this header, Cucumber will default to English (en)."

So, if Gherkin is a necessary dependence for cucumber and then for this tool... why not use lib/gherkin-languages.json to load language variants and support # language: header?

With little effort supporting the language selection and reusing gherkin lang metadata, it will boost this tool user base with all non english coders (as I am).

Right. Originally, cucumberautocomplete.formatConfOverride was added to override tab size, not to add new words. It could be used for non-English words as a temporary hack until proper format support will be added.

Yohandah commented 2 years ago

Can't format in French as well :(