exercism / v3-beta

12 stars 2 forks source link

[Page iterations] : Syntax highlighting seems broken on some exercises' iterations #41

Closed TomPradat closed 3 years ago

TomPradat commented 3 years ago

syntax-highlighting-pbm

Let me know if you need more information

iHiD commented 3 years ago

Hi. Thanks for the report. What language is this?

TomPradat commented 3 years ago

This is Javascript 👍

Le lun. 31 mai 2021 à 23:26, Jeremy Walker @.***> a écrit :

Hi. Thanks for the report. What language is this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/exercism/v3-beta/issues/41#issuecomment-851690442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3KNIGU5QC2Q5ASWAA6SN3TQP5IXANCNFSM453N2CFQ .

iHiD commented 3 years ago

Thanks. Would you mind pasting the actual code in here so I can try and reproduce pls! :)

iHiD commented 3 years ago

(cc @joshgoebel too in case it's obvious to you)

iHiD commented 3 years ago

(Btw, at a glance it looks like you might not be closing a string before we get to this bit of the code - either a mistake in your code or a mistake in some part of the highlighter)

TomPradat commented 3 years ago

Here is the code :

//
// This is only a SKELETON file for the 'Kindergarten Garden' exercise.
// It's been provided as a convenience to get you started writing code faster.
//

const DEFAULT_STUDENTS = [
  'Alice',
  'Bob',
  'Charlie',
  'David',
  'Eve',
  'Fred',
  'Ginny',
  'Harriet',
  'Ileana',
  'Joseph',
  'Kincaid',
  'Larry',
];

const PLANT_CODES = {
  G: 'grass',
  V: 'violets',
  R: 'radishes',
  C: 'clover',
};

export class Garden {
  constructor(diagram, students = DEFAULT_STUDENTS) {
    this.diagram = diagram;
    this.students = students.sort();
  }

  plants(student) {
    const [firstRow, secondRow] = this.diagram.split("\n");
        const studentIndex = this.students.indexOf(student);
    const plantsColumnIndex = studentIndex * 2;

    const plantsOfTheFirstRowOwnedByTheStudent = firstRow.slice(plantsColumnIndex, plantsColumnIndex + 2);
    const plantsOfTheSecondRowOwnedByTheStudent = secondRow.slice(plantsColumnIndex, plantsColumnIndex + 2);

    return [...plantsOfTheFirstRowOwnedByTheStudent, ...plantsOfTheSecondRowOwnedByTheStudent].map(plantCode => PLANT_CODES[plantCode]);
  }
}

It works well when I'm in the editor btw

joshgoebel commented 3 years ago

Too bad the snap is missing lines 1-13... I'd imagine there is a syntax error and a missing quote... I don't see any problem with our engine.

Screen Shot 2021-06-01 at 4 28 09 AM
TomPradat commented 3 years ago

@joshgoebel Here it is :)

Exercism

joshgoebel commented 3 years ago

It looks like it's not getting highlighted as JS but rather some other language, which would be an Exercism bug? Are we not passing the languages explicitly? We definitely should be.

iHiD commented 3 years ago

Hmm, yeah. This is a bug our end. The wrong language is getting set. I'll take a look.

iHiD commented 3 years ago

Fixed in https://github.com/exercism/website/pull/1049 :)