@@ -16,6 +16,7 @@ import * as server from '../server';
16
16
import { AnnotatedText } from '../util/AnnotatedText'
17
17
import * as text from '../util/AnnotatedText'
18
18
import { GoalsCache } from './GoalsCache' ;
19
+ import * as semver from 'semver' ;
19
20
20
21
import { Settings } from '../protocol' ;
21
22
export { StateStatus } from './State' ;
@@ -802,11 +803,19 @@ private routeId = 1;
802
803
*/
803
804
private async handleCallFailure ( error : coqtop . CallFailure , command : { range : Range , text : string } ) : Promise < proto . FailValue > {
804
805
let errorRange : Range = undefined ;
805
- if ( error . range )
806
- errorRange = vscode . Range . create (
807
- textUtil . positionAtRelativeCNL ( command . range . start , command . text , error . range . start )
808
- , textUtil . positionAtRelativeCNL ( command . range . start , command . text , error . range . stop )
809
- ) ;
806
+ if ( error . range ) {
807
+ const version = this . coqtop . getVersion ( ) ;
808
+ let start : Position ;
809
+ let end : Position ;
810
+ if ( semver . satisfies ( version , ">= 8.15" ) ) {
811
+ start = textUtil . positionAtRelative ( command . range . start , command . text , error . range . start )
812
+ end = textUtil . positionAtRelative ( command . range . start , command . text , error . range . stop )
813
+ } else {
814
+ start = textUtil . positionAtRelativeCNL ( command . range . start , command . text , error . range . start )
815
+ end = textUtil . positionAtRelativeCNL ( command . range . start , command . text , error . range . stop )
816
+ }
817
+ errorRange = vscode . Range . create ( start , end ) ;
818
+ }
810
819
811
820
const diffError = errorParsing . parseError ( error . message ) ;
812
821
const prettyError = server . project . getPrettifySymbols ( ) . prettify ( diffError )
0 commit comments