Skip to content

Blockception/BC-VSCode-Words

Blockception Vscode Words

Npm Package & Publish Npm Test tagged-release npm npm

The lexical analyzers basics used for analyzing code from VSCode documents

Examples

//Offset words contain only the offset of the word in the text
function Process(doc: TextDocument) {
  let Words = RangedWord.Parse(doc, /([^ \t\r\n]+)+/gi);

	foreach(var W in Words) {
		if (W.text === "hello") {
			let offset = W.offset;
			let pos = doc.positionAt(offset);
		}
	}
}
//Ranged words contain the start (the character and line) and end of a word
function Process(doc: TextDocument) {
  let Words = RangedWord.Parse(doc, /([^ \t\r\n]+)+/gi);

	foreach(var W in Words) {
		if (W.text === "hello") {
			let range = W.range;
		}
	}
}
//Location words contain the start (the character and line) and end of a word and the uri
function Process(doc: TextDocument) {
  let Words = LocationWord.ParseFromRegexDoc(doc, /([^ \t\r\n]+)+/gi);

	foreach(var W in Words) {
		if (W.text === "hello") {
			let range = W.location.range;
			let uri = W.location.uri
		}
	}
}

Contributing

First, read the contributing guide. fork the project, clone it and run the following commands:

Installation

  npm ci
  npm update