You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@biomejs/wasm-nodejs@1.9.2 is not compatible with @biomejs/js-api, see #3881
When I try to lint content, and it generate incorrect span range
✅ English characters:
const{ Biome, Distribution }=require('@biomejs/js-api')asyncfunctionmain(){constbiome=awaitBiome.create({distribution: Distribution.NODE})constinput='/** English comment */ let a = 123'constresult=biome.lintContent(input,{filePath: 'index.js'})for(constdiagnosticofresult.diagnostics){const[start,end]=diagnostic.location.spanconstspan=input.slice(start,end)console.log('start -->',start,'end -->',end,'span -->',span)// start --> 23 end --> 26 span --> let}}main()
❌ Chinese characters:
const{ Biome, Distribution }=require('@biomejs/js-api')asyncfunctionmain(){constbiome=awaitBiome.create({distribution: Distribution.NODE})constinput='/** 中文注释 */ let a = 123'constresult=biome.lintContent(input,{filePath: 'index.js'})for(constdiagnosticofresult.diagnostics){const[start,end]=diagnostic.location.spanconstspan=input.slice(start,end)console.log('start -->',start,'end -->',end,'span -->',span)// start --> 20 end --> 23 span --> 123}}main()
❌ Japanese characters:
const{ Biome, Distribution }=require('@biomejs/js-api')asyncfunctionmain(){constbiome=awaitBiome.create({distribution: Distribution.NODE})constinput='/** 日本語注釈 */ let a = 123'constresult=biome.lintContent(input,{filePath: 'index.js'})for(constdiagnosticofresult.diagnostics){const[start,end]=diagnostic.location.spanconstspan=input.slice(start,end)console.log('start -->',start,'end -->',end,'span -->',span)// start --> 23 end --> 26 span --> 3}}main()
Expected result
The output span is incorrect
Code of Conduct
I agree to follow Biome's Code of Conduct
The text was updated successfully, but these errors were encountered:
axetroy
changed the title
🐛 @biome/js-api diagnostic generate incorrect span range
🐛 @biome/js-api diagnostic generate incorrect span range when content has non-English characters
Sep 22, 2024
axetroy
changed the title
🐛 @biome/js-api diagnostic generate incorrect span range when content has non-English characters
🐛 @biome/js-api diagnostic generate incorrect span range when content has non-ASCII characters
Sep 22, 2024
Environment information
What happened?
@biomejs/wasm-nodejs@1.9.2
is not compatible with@biomejs/js-api
, see #3881When I try to lint content, and it generate incorrect span range
✅ English characters:
❌ Chinese characters:
❌ Japanese characters:
Expected result
The output span is incorrect
Code of Conduct
The text was updated successfully, but these errors were encountered: