Skip to content

Commit

Permalink
grab only the first 10000 characters for language detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt committed Aug 30, 2021
1 parent 56abba5 commit f28e845
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,16 @@ export class LanguageDetectionSimpleWorker extends EditorSimpleWorker {

let modelResults: ModelResult[] | undefined;
try {
modelResults = await modelOperations.runModel(content.getValue());
// Grab the first 10000 characters
const end = content.positionAt(10000);
const range = content.getValueInRange({
startColumn: 1,
startLineNumber: 1,
endColumn: end.column,
endLineNumber: end.lineNumber
});
console.log(range);
modelResults = await modelOperations.runModel(range);
} catch (e) {
console.warn(e);
}
Expand Down

0 comments on commit f28e845

Please sign in to comment.