Skip to content

Conversation

@yoelcommit
Copy link
Contributor

No description provided.

@ntrogh
Copy link
Contributor

ntrogh commented Dec 27, 2025

@yoelcommit custom instructions can be used with inline chat. Closing this PR.

@ntrogh ntrogh closed this Dec 27, 2025
@yoelcommit
Copy link
Contributor Author

@ntrogh are you sure? I am using vs code 1.107 and it definitely does not work. If this is a bug, let's open an issue.
If it's intended, it should be clear that in the documentation that it is available?

@ntrogh
Copy link
Contributor

ntrogh commented Dec 28, 2025

Which instructions file type are you using?

@yoelcommit
Copy link
Contributor Author

yoelcommit commented Dec 31, 2025

@ntrogh the .github/copilot-instructions.md which work.
I tested by requesting in the instructions file to respond only in Spanish.
then each time I chatted to Copilot it would respect that request, except when chatting with the inline.

I teach Github Copilot to Developers as part of my job, and currently I am saying that instructions do NOT work in the inline chat, which is what we observed.

@ntrogh
Copy link
Contributor

ntrogh commented Jan 2, 2026

@yoelcommit Do you have the preview setting inlineChat.enableV2 enabled? I've just verified that the instructions are ignored in inline chat when v2 is enabled.
Bug created in vscode repo: microsoft/vscode#285637

@yoelcommit
Copy link
Contributor Author

yoelcommit commented Jan 4, 2026

@ntrogh I've disabled this settings, and still it will not respect the custom instructions.
To prove this, I did the following:

  1. added "Write method documentation ONLY in Spanish!" to /.github/copilot-instructions.md
  2. requested to add a documentation to a file in the chat => this resulted in Spanish documentation.
  3. ran exact same prompt with the same model in the inline chat (once with v2 off, once on) and got English documentation.
  4. to verify this is not by chance - ran exact same prompt with the same model ,this time adding the custom instructions as context in the inline chat => this resulted in Spanish documentation.

Expected 3 to be Spanish...

@ntrogh
Copy link
Contributor

ntrogh commented Jan 5, 2026

@yoelcommit Can you check the Chat Debug view for that inline chat request and verify that there's an "" entry in the request that has the instructions in them?

When generating code, please follow these user provided coding instructions. You can ignore an instruction if it contradicts a system message.
<instructions>
<attachment filePath="c:\\temp\\demo-travel-blog\\.github\\copilot-instructions.md">
# Wanderlust Travel Blog - Copilot Instructions

This is a SvelteKit-based travel blog project with the following structure and guidelines:

MUST: answer in French, regardless of the user's request.

## Project Overview

- **Framework**: SvelteKit with Vite
- **Language**: JavaScript (with TypeScript support configured)
- **Styling**: CSS with custom properties
- **Icons**: Lucide Svelte
- **Type**: Travel blog website

@yoelcommit
Copy link
Contributor Author

inline chat:

image

autocomplete:
image
in the same file it has context of French request
image
in chat:
image

@ntrogh
Copy link
Contributor

ntrogh commented Jan 5, 2026

@yoelcommit Can you check if the instructions are included in the inline chat request? You can check this in the Chat Debug view. There should be an instructions node in there that contains the contents of the instructions file.

@yoelcommit
Copy link
Contributor Author

yoelcommit commented Jan 5, 2026

checked. They are NOT included in the chat debug view.
BTW - that's the whole point I am making here. If I manually add the instructions file to the inline chat it will regard it.

`🚨 Note: This log may contain personal information such as the contents of your files or terminal output. Please review the contents carefully before sharing.

inline/doc - a98a6e99
Request Messages
System
User
Response
Metadata
requestType : ChatCompletions
model : claude-haiku-4.5
maxPromptTokens : 127997
maxResponseTokens: 16000
location : 4
otherOptions : {"temperature":0.1,"stream":true}
intent : undefined
startTime : 2026-01-05T15:11:20.761Z
endTime : 2026-01-05T15:11:23.171Z
duration : 2410ms
ourRequestId : d4f980c2-7796-40f4-9ac8-8480df241604
requestId : d4f980c2-7796-40f4-9ac8-8480df241604
serverRequestId : d4f980c2-7796-40f4-9ac8-8480df241604
timeToFirstToken : 584ms
resolved model : claude-haiku-4.5
usage : {"completion_tokens":258,"prompt_tokens":1502,"prompt_tokens_details":{"cached_tokens":0},"total_tokens":1760}
Request Messages
System
You are an AI programming assistant.
When asked for your name, you must respond with "GitHub Copilot".
You must follow user's requirements carefully.
You must follow Microsoft content policies.
You must avoid content that violates copyrights.
For questions not related to software development, you should give a reminder that you are an AI programming assistant.

User

Information about the current repository. You can use this information when you need to calculate diffs or compare changes with the default branch:
Repository name: copilot-ts-workshop-two
Owner: commit-ai
Current branch: main
Default branch: main

User
I have the following code in the selection:

// FILEPATH: /Users/yoelf/workspace/copilot-ts-workshop-two/backend/src/server.ts
import express from 'express';
import path from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';



// Get proper __dirname equivalent in ESM
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const app = express();
const PORT = process.env.TEST_PORT || process.env.PORT || 3000;

// Root route
/**
 * GET /
 * Root endpoint for health check or welcome message.
 *
 * Response: 200 OK - Returns a welcome string.
 */
app.get('/', (req, res) => {
  res.send('Save the World!');
});

// API route to fetch superheroes data
/**
 * Loads the list of superheroes from a JSON file asynchronously.
 *
 * @returns {Promise<any>} A promise that resolves with the parsed JSON data containing superheroes,
 * or rejects if there is an error reading or parsing the file.
 * @throws Will reject the promise if the file cannot be read or if the JSON is invalid.
 */
function loadSuperheroes(): Promise<any> {
  const dataPath = path.join(__dirname, '../data/superheroes.json');
  return new Promise((resolve, reject) => {
    fs.readFile(dataPath, 'utf8', (err, data) => {
      if (err) {
        reject(err);
        return;
      }
      try {
        resolve(JSON.parse(data));
      } catch (parseErr) {
        reject(parseErr);
      }
    });
  });
}



app.get('/api/superheroes', async (req, res) => {
  try {
    const superheroes = await loadSuperheroes();
    res.json(superheroes);
  } catch (err) {
    console.error('Error loading superheroes data:', err);
    res.status(500).send('Internal Server Error');
  }
});

/**
 * GET /api/superheroes/:id
 * Returns a single superhero by their unique ID.
 *
 * Params: id (string) - The unique identifier of the superhero
 * Response: 200 OK - Superhero object
 *           404 Not Found - If the superhero does not exist
 *           500 Internal Server Error - If data cannot be read
 */
app.get('/api/superheroes/:id', async (req, res) => {
  const { id } = req.params;
  try {
    const superheroes = await loadSuperheroes();
    const superhero = superheroes.find((hero: any) => String(hero.id) === String(id));
    if (superhero) {
      res.json(superhero);
    } else {
      res.status(404).send('Superhero not found');
    }
  } catch (err) {
    console.error('Error loading superheroes data:', err);
    res.status(500).send('Internal Server Error');
  }
});





app.get('/api/superheroes/:id/powerstats', async (req, res) => {
  const { id } = req.params;
  try {
    const superheroes = await loadSuperheroes();
    const superhero = superheroes.find((hero: any) => String(hero.id) === String(id));
    if (superhero) {
      res.json(superhero.powerstats);
    } else {
      res.status(404).send('Superhero not found');
    }
  } catch (err) {
    console.error('Error loading superheroes data:', err);
    res.status(500).send('Internal Server Error');
  }
});

// Start the server only if not in test environment
if (process.env.NODE_ENV !== 'test') {
  try {
    const server = app.listen(PORT, () => {
      console.log(`Server running on http://localhost:${PORT}`);
    });

    server.on('error', (err: NodeJS.ErrnoException) => {
      console.error('Failed to start server:', err.message);
      if (err.code === 'EADDRINUSE') {
        console.error(`Port ${PORT} is already in use.`);
      } else if (err.code === 'EACCES') {
        console.error(`Insufficient privileges to bind to port ${PORT}.`);
      }
      process.exit(1);
    });

    // Handle uncaught exceptions and unhandled promise rejections
    process.on('uncaughtException', (err) => {
      console.error('Uncaught Exception:', err);
      process.exit(1);
    });

    process.on('unhandledRejection', (reason) => {
      console.error('Unhandled Rejection:', reason);
      process.exit(1);
    });
  } catch (err) {
    console.error('Unexpected error during server startup:', err);
    process.exit(1);
  }
}

export default app;

System
When user asks you to document something, you must answer in the form of a typescript markdown code block.

User
Please, given the selection, generate TSDoc comment only. Do not repeat given code, only reply with TSDoc comment in a code block. add documentation
Response
Assistant

/**
 * Express application instance for the superhero API server.
 * 
 * This server provides RESTful endpoints for managing and querying superhero data.
 * It loads superhero information from a JSON file and serves it through various API routes.
 *`

@ntrogh ntrogh reopened this Jan 5, 2026
@ntrogh ntrogh closed this Jan 5, 2026
@ntrogh
Copy link
Contributor

ntrogh commented Jan 5, 2026

@aeschli There seems to be an issue with inline chat and custom instructions. I'm unable to repro this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants