protected Collection<AssemblyCompletion> computeCompletions(String text) {
		final AssemblyPatternBlock ctx = Objects.requireNonNull(getContext());

		Set<AssemblyCompletion> result = new TreeSet<>();
		Collection<AssemblyParseResult> parses = assembler.parseLine(text);
		for (AssemblyParseResult parse : parses) {
			if (parse.isError()) {
				AssemblyParseErrorResult err = (AssemblyParseErrorResult) parse;
				String buffer = err.getBuffer();
				for (String s : err.getSuggestions()) {
					if (s.startsWith(buffer)) {
						result.add(new AssemblySuggestion(s.substring(buffer.length()),
							formatSuggestion(text, s, buffer)));
					}
				}
			}
		}

		Program program = assembler.getProgram();
		Language language = assembler.getLanguage();
		Register ctxReg = language.getContextBaseRegister();
		RegisterValue ctxVal = new RegisterValue(ctxReg, ctx.toBigInteger(ctxReg.getNumBytes()));
		// HACK (Sort of): Don't use text passed in. Get full text.
		String fullText = getText();
		parses = assembler.parseLine(fullText);
		for (AssemblyParseResult parse : parses) {
			if (!parse.isError()) {
				AssemblyResolutionResults sems = assembler.resolveTree(parse, address, ctx);
				for (AssemblyResolution ar : sems) {
					if (ar.isError()) {
						//result.add(new AssemblyError("", ar.toString()));
						continue;
					}
					AssemblyResolvedPatterns rc = (AssemblyResolvedPatterns) ar;
					for (byte[] ins : rc.possibleInsVals(ctx)) {
						AssemblyInstruction ai = new AssemblyInstruction(program, language, address,
							text, Arrays.copyOf(ins, ins.length), ctxVal, computePreference(rc));
						result.add(ai);
						if (!exhaustUndefined) {
							break;
						}
					}
				}
			}
		}

		if (result.isEmpty()) {
			result.add(new AssemblyError("", "Invalid instruction and/or prefix"));
		}
		return result;
	}
Compute valid completions given the prefix

<p>
This is an extension point.

<p>
If text parses and assembles, then the completion set will include assembled instruction-byte
entries. Note that there may still be valid textual completions to continue the instruction.
The suggestions yielded by all syntax errors are used to create textual completions. If the
suggestion is prefixed by the buffer where the syntax error occurred, then, the tail of that
suggestion is made into a completion entry.

@param text the prefix
@return the collection of completion items
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AssemblyDualTextField.java