src/diagnostics.js
/**
 * Analyzes the text document for problems. 
 * This demo diagnostic problem provider finds all mentions of keyword.
 * @param doc text document to analyze
 * @param docDiagnostics diagnostic collection
 * @param message diagnostic message
 */
Analyzes the text document for problems.
This demo diagnostic problem provider finds all mentions of keyword.
@param doc text document to analyze
@param docDiagnostics diagnostic collection
@param message diagnostic message
Analyzes the text document for problems . This demo diagnostic problem provider finds all mentions of keyword . @param doc text document to analyze @param docDiagnostics diagnostic collection @param message diagnostic message
function refreshDiagnostics(doc, docDiagnostics, message) {
	const diagnostics = []
	if (message !== 'Valid') {
		let apiWord
		for (let lineIndex = 0; lineIndex < doc.lineCount; lineIndex++) {
			const lineOfText = doc.lineAt(lineIndex)
			for (let word = 0; word < apiWords.length; word++) {
				if (lineOfText.text.includes(apiWords[word])) {
					apiWord = apiWords[word]
					diagnostics.push(createDiagnostic(lineOfText, lineIndex, apiWord, message))
					break
				}
			}
			if (apiWord) {
				break
			}
		}
	}
	docDiagnostics.set(doc.uri, diagnostics)
}
function refreshDiagnostics ( doc , docDiagnostics , message ) { const diagnostics = [ ] if ( message !== 'Valid' ) { let apiWord for ( let lineIndex = 0 ; lineIndex < doc . lineCount ; lineIndex ++ ) { const lineOfText = doc . lineAt ( lineIndex ) for ( let word = 0 ; word < apiWords . length ; word ++ ) { if ( lineOfText . text . includes ( apiWords [ word ] ) ) { apiWord = apiWords [ word ] diagnostics . push ( createDiagnostic ( lineOfText , lineIndex , apiWord , message ) ) break } } if ( apiWord ) { break } } } docDiagnostics . set ( doc . uri , diagnostics ) }
Analyzes the text document for problems.
Analyzes the text document for problems .
// If word found break loop // If word found break loop