Skip to content

Commit

Permalink
Rename IdeError to IdeDiagnostic.
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner committed Apr 3, 2024
1 parent 8ecd240 commit ecd63b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions server/src/fstar_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as crypto from 'crypto';

import { Server } from './server';
import { StatusOkMessage, ok_kind } from './client_connection';
import { IdeLookupResponseResponse, IdeProofState, IdeError, IdeProgress, IdeAutoCompleteOptions, FStarRange } from './fstar_messages';
import { IdeLookupResponseResponse, IdeProofState, IdeDiagnostic, IdeProgress, IdeAutoCompleteOptions, FStarRange } from './fstar_messages';
import { mkPosition, fstarRangeAsRange, qualifyFilename } from './utils';


Expand Down Expand Up @@ -129,7 +129,7 @@ export function handleIdeProgress(textDocument: TextDocument, contents: IdeProgr

// If we get errors and warnings from F*, we send them to VSCode as diagnostics,
// which will show them as squiggles in the editor.
export function handleIdeDiagnostics(textDocument: TextDocument, response: IdeError[], lax: boolean, server: Server) {
export function handleIdeDiagnostics(textDocument: TextDocument, response: IdeDiagnostic[], lax: boolean, server: Server) {
function ideErrorLevelAsDiagnosticSeverity(level: string): DiagnosticSeverity {
switch (level) {
case "warning": return DiagnosticSeverity.Warning;
Expand Down
6 changes: 2 additions & 4 deletions server/src/fstar_messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ export interface IdeProofStateGoal {

// IDEError: fstar.exe sends this message when reporting errors and warnings
//
// TODO(klinvill): These status messages aren't necessarily errors. Maybe should
// be renamed to `IdeDiagnostic` (following the `handleIdeDiagnostics` name)?
export interface IdeError {
export interface IdeDiagnostic {
message: string;
number: number;
level: 'warning' | 'error' | 'info';
Expand Down Expand Up @@ -155,7 +153,7 @@ export interface IdeLookupResponse extends IdeQueryResponse {

// Documented at https://github.com/FStarLang/FStar/wiki/Editor-support-for-F*#push
export interface IdeDiagnosticsResponse extends IdeQueryResponse {
response: IdeError[];
response: IdeDiagnostic[];
}

// Replies stemming from full-buffer interruptions seem to have an empty (null)
Expand Down
4 changes: 2 additions & 2 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { formatIdeProofState, fstarRangeAsRange, mkPosition, qualifyFilename, ra
import { ClientConnection } from './client_connection';
import { FStarConnection, StreamedResult } from './fstar_connection';
import { FStar } from './fstar';
import { FStarRange, IdeProofState, IdeProgress, IdeError, FullBufferQueryResponse } from './fstar_messages';
import { FStarRange, IdeProofState, IdeProgress, IdeDiagnostic, FullBufferQueryResponse } from './fstar_messages';
import { handleIdeDiagnostics, handleIdeProgress, handleIdeProofState } from './fstar_handlers';

// LSP Server
Expand Down Expand Up @@ -319,7 +319,7 @@ export class Server {
if (!response.response) {
console.info("Query cancelled");
} else if (Array.isArray(response.response)) {
handleIdeDiagnostics(textDocument, response.response as IdeError[], lax === 'lax', this);
handleIdeDiagnostics(textDocument, response.response as IdeDiagnostic[], lax === 'lax', this);
} else {
// ignore
}
Expand Down

0 comments on commit ecd63b4

Please sign in to comment.