Abdelghani
Abdelghani

Reputation: 745

vscode version 1.97 : Position.compare is not a function

I recently updated Vscode to version 1.97. Now all the call to compareTo on a Position object is raising error : "myposition.compareTo is not a function" (same with isBefore, isAfter, ....)

I noticed this does not happen if I create the position inside the function that is calling compareTo. This only happens with Position objects are parameters of this function.

function myFunction (currentPos: Position){
  let anotherPosition = new Position(currentPos.line, currentPos.character);
  window.showInformationMessage("comparing positions works " + anotherPosition.compareTo(currentPos));
  // this shows information message `comparing positions works 0`
  window.showInformationMessage("comparing positions works " + currentPos.compareTo(anotherPosition));
  // this shows an Error message `currentPos.compareTo is not a function` 
}

Any idea why this happening with version 1.97?

Upvotes: -1

Views: 21

Answers (0)

Related Questions